How to use the lua-types.varargLiteral function in lua-types

To help you get started, we’ve selected a few lua-types examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ark120202 / babel-lua / packages / babel-plugin-lua-generator / src / transformers / methods.js View on Github external
return function FunctionHandler(node) {
    const body = this.transformBlock(node.body);
    const restParam = node.params.find(param => bt.isRestElement(param));
    if (restParam) {
      body.unshift(
        t.localStatement(
          [restParam.argument],
          [t.tableConstructorExpression([t.tableValue(t.varargLiteral())])],
        ),
      );
    }

    return t.functionStatement(
      isExp ? null : this.transform(node.id),
      this.transformList(node.params),
      // Simulate module structure for declaration
      !isExp,
      body,
    );
  };
}