summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-12-10 00:34:50 +1100
committerdaurnimator <quae@daurnimator.com>2017-12-10 00:34:50 +1100
commit4dc16cdef46f2d9176c39f7007bc84251b85570c (patch)
treebe4b6282328b1554eaebfa49054eb45331a49b8d /src
parent4d8bd2b823eddada773a84e4004c380cf7de8762 (diff)
downloadfengari-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')
-rw-r--r--src/lobject.js6
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>"));