summaryrefslogtreecommitdiff
path: root/src/ltable.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-04 11:54:16 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-04 11:55:49 +1000
commit24e4656be7105e090e2f1a76a294daf2d9c293af (patch)
tree92d92591e70766bfd962e5e8f95300fad59a024c /src/ltable.js
parentadb15f3073139981fa38ed61587513a92065cf03 (diff)
downloadfengari-24e4656be7105e090e2f1a76a294daf2d9c293af.tar.gz
fengari-24e4656be7105e090e2f1a76a294daf2d9c293af.tar.bz2
fengari-24e4656be7105e090e2f1a76a294daf2d9c293af.zip
Add more/correct validation around integers
Diffstat (limited to 'src/ltable.js')
-rw-r--r--src/ltable.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ltable.js b/src/ltable.js
index d6fffe9..ac12bd2 100644
--- a/src/ltable.js
+++ b/src/ltable.js
@@ -49,7 +49,7 @@ const getgeneric = function(t, hash) {
};
const luaH_getint = function(t, key) {
- assert(typeof key == "number");
+ assert(typeof key == "number" && (key|0) === key);
return getgeneric(t, key);
};
@@ -79,7 +79,7 @@ const setgeneric = function(t, hash, key) {
};
const luaH_setint = function(t, key, value) {
- assert(typeof key == "number" && value instanceof lobject.TValue && (key|0) === key);
+ assert(typeof key == "number" && (key|0) === key && value instanceof lobject.TValue);
let hash = key; /* table_hash known result */
let v = t.strong.get(hash);
if (v) {