LuaObject.func constructor

LuaObject.func(
  1. String id,
  2. FuncExpr def,
  3. Function closure, [
  4. Scope? pscope,
])

Constructs a lua function with id for its function name in scope with some closure to be written to value. A required def is needed to determine the input arguments and other runtime information.

Attributes attr are omitted from function objects. A constant variable will point to this object.

Implementation

LuaObject.func(this.id, FuncExpr def, Function closure, [Scope? pscope])
  : attr = null,
   super() {
  _fields = {};

  // Order here matters. value will clear funcDef and scope.
  value = closure;
  funcDef = def;
  scope = pscope;
}