summaryrefslogtreecommitdiff
path: root/src/ltm.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-03-12 10:38:13 +0100
committerBenoit Giannangeli <giann@users.noreply.github.com>2017-03-13 11:03:24 +0100
commit883d01f0a707a03ef5b183cd2d03046fdc544e0e (patch)
tree33631e31bfa1d925735303cb3e6fac5265fa62ee /src/ltm.js
parent52fa5f8a97fd5322fcb110298c4ce14328074818 (diff)
downloadfengari-883d01f0a707a03ef5b183cd2d03046fdc544e0e.tar.gz
fengari-883d01f0a707a03ef5b183cd2d03046fdc544e0e.tar.bz2
fengari-883d01f0a707a03ef5b183cd2d03046fdc544e0e.zip
[Strings] ltable.js, ltm.js
Diffstat (limited to 'src/ltm.js')
-rw-r--r--src/ltm.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/ltm.js b/src/ltm.js
index 742ce56..51ab8ec 100644
--- a/src/ltm.js
+++ b/src/ltm.js
@@ -63,7 +63,8 @@ const ttypename = function(t) {
const luaT_init = function(L) {
L.l_G.tmname = [];
for (let event in TMS) {
- L.l_G.tmname.push(new TValue(CT.LUA_TLNGSTR, TMS[event])); // Strings are already interned by JS
+ let name = lua.to_luastring(TMS[event], TMS[event].length);
+ L.l_G.tmname.push(L.l_G.intern(name)); // Strings are already interned by JS
}
};
@@ -76,7 +77,7 @@ const luaT_objtypename = function(L, o) {
|| (o.ttisfulluserdata() && o.metatable !== null)) {
let name = o.__index(o, '__name');
if (name.ttisstring())
- return name.value;
+ return String.fromCharCode(...name.value);
}
return ttypename(o.ttnov());