How to use the lua-types.indexExpression 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 / expressions.js View on Github external
export function MemberExpression(node, parent) {
  if (node.computed) {
    return t.indexExpression(this.transform(node.object), this.transform(node.property));
  }

  // Always pass context in calls, since most of Lua apis expect it
  const indexer =
    bt.isCallExpression(parent) && parent.callee === node && !node[NO_CONTEXT] ? ':' : '.';
  return t.memberExpression(this.transform(node.object), indexer, this.transform(node.property));
}
github ark120202 / babel-lua / packages / babel-plugin-lua-generator / src / transformers / expressions.js View on Github external
export function SequenceExpression(node) {
  return t.indexExpression(
    t.tableConstructorExpression(this.transformList(node.expressions).map(n => t.tableValue(n))),
    t.numericLiteral(node.expressions.length),
  );
}