"use strict"; const { constant_types: { LUA_TNIL } } = require('./defs.js'); const lobject = require('./lobject.js'); class Proto { constructor(L) { this.id = L.l_G.id_counter++; this.k = []; // constants used by the function this.p = []; // functions defined inside the function this.code = []; // opcodes this.cache = null; // last-created closure with this prototype this.lineinfo = []; // map from opcodes to source lines (debug information) this.upvalues = []; // upvalue information this.numparams = 0; // number of fixed parameters this.is_vararg = false; this.maxstacksize = 0; // number of registers needed by this function this.locvars = []; // information about local variables (debug information) this.linedefined = 0; // debug information this.lastlinedefined = 0; // debug information this.source = null; // used for debug information } } const luaF_newLclosure = function(L, n) { return new lobject.LClosure(L, n); }; const luaF_findupval = function(L, level) { return L.stack[level]; }; const luaF_close = function(L, level) { /* Create new TValues on stack; * any closures will keep referencing old TValues */ for (let i=level; i