diff options
author | Benoit Giannangeli <giann008@gmail.com> | 2017-03-12 16:48:53 +0100 |
---|---|---|
committer | Benoit Giannangeli <giann@users.noreply.github.com> | 2017-03-13 11:03:24 +0100 |
commit | 2a6993bf0e23e2a3759abb9d7127525577dc346c (patch) | |
tree | 2b605f78ee91ca242770c1573d1c2138677fd66b /src/lobject.js | |
parent | 4c404c404c281f1872f0283acbaee97657f3e08b (diff) | |
download | fengari-2a6993bf0e23e2a3759abb9d7127525577dc346c.tar.gz fengari-2a6993bf0e23e2a3759abb9d7127525577dc346c.tar.bz2 fengari-2a6993bf0e23e2a3759abb9d7127525577dc346c.zip |
Testing 8-bit strings
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 92dd560..739db50 100644 --- a/src/lobject.js +++ b/src/lobject.js @@ -110,6 +110,10 @@ class TValue { return this.ttisnil() || (this.ttisboolean() && this.value === false); } + jsstring() { + return this.ttisstring() ? String.fromCharCode(...this.value) : null; + } + } const nil = new TValue(CT.LUA_TNIL, null); @@ -133,6 +137,8 @@ class Table extends TValue { } else if ([CT.LUA_TSHRSTR, CT.LUA_TLNGSTR].indexOf(key.type) > -1) { key = key.value.map(e => `${e}|`).join(''); } + } else if (typeof key === "string") { // To avoid + key = lua.to_luastring(key).map(e => `${e}|`).join(''); } return key; |