diff options
author | daurnimator <quae@daurnimator.com> | 2017-12-10 00:34:50 +1100 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2017-12-10 00:34:50 +1100 |
commit | 4dc16cdef46f2d9176c39f7007bc84251b85570c (patch) | |
tree | be4b6282328b1554eaebfa49054eb45331a49b8d /src/lobject.js | |
parent | 4d8bd2b823eddada773a84e4004c380cf7de8762 (diff) | |
download | fengari-4dc16cdef46f2d9176c39f7007bc84251b85570c.tar.gz fengari-4dc16cdef46f2d9176c39f7007bc84251b85570c.tar.bz2 fengari-4dc16cdef46f2d9176c39f7007bc84251b85570c.zip |
src/lobject.js: Add ids in the form of JS constructors for primitives
Diffstat (limited to 'src/lobject.js')
-rw-r--r-- | src/lobject.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lobject.js b/src/lobject.js index 8754e20..04a08c0 100644 --- a/src/lobject.js +++ b/src/lobject.js @@ -576,6 +576,12 @@ const luaO_pushvfstring = function(L, fmt, argp) { v instanceof CClosure || v instanceof lfunc.UpVal) { pushstr(L, defs.to_luastring("0x"+v.id.toString(16))); + } else if (typeof v === "number") { /* before check object as null is an object */ + pushstr(L, defs.to_luastring("Number("+v+")")); + } else if (typeof v === "string") { /* before check object as null is an object */ + pushstr(L, defs.to_luastring("String("+JSON.stringify(v)+")")); + } else if (typeof v === "boolean") { /* before check object as null is an object */ + pushstr(L, defs.to_luastring(v?"Boolean(true)":"Boolean(false)")); } else { /* user provided object. no id available */ pushstr(L, defs.to_luastring("<id NYI>")); |