From 4dc16cdef46f2d9176c39f7007bc84251b85570c Mon Sep 17 00:00:00 2001 From: daurnimator Date: Sun, 10 Dec 2017 00:34:50 +1100 Subject: src/lobject.js: Add ids in the form of JS constructors for primitives --- src/lobject.js | 6 ++++++ 1 file changed, 6 insertions(+) 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("")); -- cgit v1.2.3-70-g09d2