aboutsummaryrefslogtreecommitdiff
path: root/src/lapi.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-04-18 15:20:37 +0200
committerBenoit Giannangeli <giann008@gmail.com>2017-04-18 15:20:37 +0200
commita02f4e93b92e7ebb7ef038ad151e51652b0ce84d (patch)
tree2b83cacef266ff88ca3ed8cf3f19c1a1cbea7b38 /src/lapi.js
parent924ca09e8e9ec765301868d90dd3eba98058cafb (diff)
downloadfengari-a02f4e93b92e7ebb7ef038ad151e51652b0ce84d.tar.gz
fengari-a02f4e93b92e7ebb7ef038ad151e51652b0ce84d.tar.bz2
fengari-a02f4e93b92e7ebb7ef038ad151e51652b0ce84d.zip
No more Table, just TValue with table type and Map value
Diffstat (limited to 'src/lapi.js')
-rw-r--r--src/lapi.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/lapi.js b/src/lapi.js
index 35f8d21..99b0859 100644
--- a/src/lapi.js
+++ b/src/lapi.js
@@ -336,8 +336,8 @@ const auxsetstr = function(L, t, k) {
assert(1 < L.top - L.ci.funcOff, "not enough elements in the stack");
- if (t.ttistable() && !t.__index(t, k).ttisnil()) {
- t.__newindex(t, k, L.stack[L.top - 1]);
+ if (t.ttistable() && !lobject.table_index(t, k).ttisnil()) {
+ lobject.table_newindex(t, k, L.stack[L.top - 1]);
L.top--; /* pop value */
} else {
L.stack[L.top++] = str;
@@ -400,7 +400,7 @@ const lua_rawset = function(L, idx) {
assert(2 < L.top - L.ci.funcOff, "not enough elements in the stack");
let o = index2addr(L, idx);
assert(o.ttistable(), "table expected");
- o.__newindex(o, L.stack[L.top - 2], L.stack[L.top - 1]);
+ lobject.table_newindex(o, L.stack[L.top - 2], L.stack[L.top - 1]);
L.top -= 2;
};
@@ -409,7 +409,7 @@ const lua_rawsetp = function(L, idx, p) {
let o = index2addr(L, idx);
assert(L, o.ttistable(), "table expected");
let k = p;
- o.__newindex(o, k, L.stack[L.top - 1]);
+ lobject.table_newindex(o, k, L.stack[L.top - 1]);
L.top--;
};
@@ -421,7 +421,7 @@ const auxgetstr = function(L, t, k) {
assert(Array.isArray(k), "key must be an array of bytes");
let str = L.l_G.intern(k);
- let slot = t.__index(t, k);
+ let slot = lobject.table_index(t, k);
if (t.ttistable() && !slot.ttisnil()) {
L.stack[L.top++] = slot;
assert(L.top <= L.ci.top, "stack overflow");
@@ -439,7 +439,7 @@ const lua_rawgeti = function(L, idx, n) {
assert(t.ttistable(), "table expected");
- L.stack[L.top++] = t.__index(t, n);
+ L.stack[L.top++] = lobject.table_index(t, n);
assert(L.top <= L.ci.top, "stack overflow");
@@ -450,7 +450,7 @@ const lua_rawgetp = function(L, idx, p) {
let t = index2addr(L, idx);
assert(t.ttistable(), "table expected");
let k = p;
- L.stack[L.top++] = t.__index(t, k);
+ L.stack[L.top++] = lobject.table_index(t, k);
assert(L.top <= L.ci.top, "stack overflow");
return L.stack[L.top - 1].ttnov();
};
@@ -460,14 +460,14 @@ const lua_rawget = function(L, idx) {
assert(t.ttistable(t), "table expected");
- L.stack[L.top - 1] = t.__index(t, L.stack[L.top - 1]);
+ L.stack[L.top - 1] = lobject.table_index(t, L.stack[L.top - 1]);
return L.stack[L.top - 1].ttnov();
};
// narray and nrec are mostly useless for this implementation
const lua_createtable = function(L, narray, nrec) {
- let t = new lobject.Table();
+ let t = new lobject.TValue(CT.LUA_TTABLE, new Map());
L.stack[L.top++] = t;
assert(L.top <= L.ci.top, "stack overflow");
@@ -577,7 +577,7 @@ const lua_getfield = function(L, idx, k) {
const lua_geti = function(L, idx, n) {
let t = index2addr(L, idx);
- let slot = t.__index(t, n);
+ let slot = lobject.table_index(t, n);
if (!slot.ttisnil()) {
L.stack[L.top++] = slot;
assert(L.top <= L.ci.top, "stack overflow");