summaryrefslogtreecommitdiff
path: root/src/lobject.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/lobject.js')
-rw-r--r--src/lobject.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/lobject.js b/src/lobject.js
index 2ba45ad..4e4b701 100644
--- a/src/lobject.js
+++ b/src/lobject.js
@@ -121,7 +121,8 @@ class Table extends TValue {
static keyValue(key) {
// Those lua values are used by value, others by reference
if (key instanceof TValue
- && [CT.LUA_TSTRING,
+ && [CT.LUA_TNIL,
+ CT.LUA_TSTRING,
CT.LUA_TSHRSTR,
CT.LUA_TLNGSTR,
CT.LUA_TNUMINT].indexOf(key.type) > -1) {
@@ -135,9 +136,9 @@ class Table extends TValue {
key = Table.keyValue(key);
if (typeof key === 'number' && key > 0) {
- table.value.hash.set(key - 1, value); // Lua array starts at 1
+ table.value.set(key - 1, value); // Lua array starts at 1
} else {
- table.value.hash.set(key, value);
+ table.value.set(key, value);
}
}
@@ -146,9 +147,9 @@ class Table extends TValue {
let v = nil;
if (typeof key === 'number' && key > 0) {
- v = table.value.hash.get(key - 1); // Lua array starts at 1
+ v = table.value.get(key - 1); // Lua array starts at 1
} else {
- v = table.value.hash.get(key);
+ v = table.value.get(key);
}
return v ? v : nil;