diff options
-rw-r--r-- | src/lfunc.js | 5 | ||||
-rw-r--r-- | src/lobject.js | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/lfunc.js b/src/lfunc.js index 97e5f02..b4684e1 100644 --- a/src/lfunc.js +++ b/src/lfunc.js @@ -29,7 +29,8 @@ class Proto { class UpVal { - constructor() { + constructor(L) { + this.id = L.l_G.id_counter++; this.v = void 0; /* if open: reference to TValue on stack. if closed: TValue */ this.vOff = void 0; /* if open: index on stack. if closed: undefined */ this.refcount = 0; @@ -59,7 +60,7 @@ const luaF_findupval = function(L, level) { p = p.open_next; } /* not found: create a new upvalue */ - let uv = new UpVal(); + let uv = new UpVal(L); /* link it to list of open upvalues */ uv.open_next = p; if (prevp) diff --git a/src/lobject.js b/src/lobject.js index db76cb5..44d8c9b 100644 --- a/src/lobject.js +++ b/src/lobject.js @@ -7,6 +7,7 @@ const defs = require('./defs.js'); const ljstype = require('./ljstype.js'); const ldebug = require('./ldebug.js'); const ldo = require('./ldo.js'); +const lfunc = require('./lfunc.js'); const lstate = require('./lstate.js'); const lstring = require('./lstring.js'); const ltable = require('./ltable.js'); @@ -577,7 +578,8 @@ const luaO_pushvfstring = function(L, fmt, argp) { v instanceof ltable.Table || v instanceof Udata || v instanceof LClosure || - v instanceof CClosure) { + v instanceof CClosure || + v instanceof lfunc.UpVal) { pushstr(L, defs.to_luastring("0x"+v.id.toString(16))); } else { /* user provided object. no id available */ |