aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-04-27 17:58:58 +1000
committerBenoit Giannangeli <giann008@gmail.com>2017-04-28 14:15:58 +0200
commit58bd4012506e6dfc92dd819d4e43acad18e8b914 (patch)
tree1db44a36cdd61d8629e3485a80fe9a57997e04b8 /src
parent18fde8bd2285ad45baa9f9b2f16b40fb6bd3b2dd (diff)
downloadfengari-58bd4012506e6dfc92dd819d4e43acad18e8b914.tar.gz
fengari-58bd4012506e6dfc92dd819d4e43acad18e8b914.tar.bz2
fengari-58bd4012506e6dfc92dd819d4e43acad18e8b914.zip
lua_State shouldn't subclass TValue
Diffstat (limited to 'src')
-rw-r--r--src/lapi.js2
-rw-r--r--src/lobject.js1
-rw-r--r--src/lstate.js7
3 files changed, 4 insertions, 6 deletions
diff --git a/src/lapi.js b/src/lapi.js
index 52bc8fa..a758a66 100644
--- a/src/lapi.js
+++ b/src/lapi.js
@@ -305,7 +305,7 @@ const lua_pushlightuserdata = function(L, p) {
};
const lua_pushthread = function(L) {
- L.stack[L.top++] = L;
+ L.stack[L.top++] = new TValue(CT.LUA_TTHREAD, L);
assert(L.top <= L.ci.top, "stack overflow");
return L.l_G.mainthread === L;
diff --git a/src/lobject.js b/src/lobject.js
index f7d07d7..5a202d4 100644
--- a/src/lobject.js
+++ b/src/lobject.js
@@ -167,6 +167,7 @@ const table_keyValue = function(key) {
if ([CT.LUA_TNIL,
CT.LUA_TBOOLEAN,
CT.LUA_TSTRING,
+ CT.LUA_TTHREAD,
CT.LUA_TNUMINT].indexOf(key.type) > -1) {
key = key.value;
} else if ([CT.LUA_TSHRSTR, CT.LUA_TLNGSTR].indexOf(key.type) > -1) {
diff --git a/src/lstate.js b/src/lstate.js
index 1a4cbd5..349c723 100644
--- a/src/lstate.js
+++ b/src/lstate.js
@@ -41,10 +41,9 @@ class CallInfo {
}
-class lua_State extends lobject.TValue {
+class lua_State {
constructor() {
- super(CT.LUA_TTHREAD, null);
this.base_ci = new CallInfo(); // Will be populated later
this.top = 0;
this.ci = null;
@@ -57,8 +56,6 @@ class lua_State extends lobject.TValue {
this.errorJmp = null;
this.nny = 1;
this.errfunc = 0;
-
- this.value = this;
}
}
@@ -147,7 +144,7 @@ const preinit_thread = function(L, g) {
const lua_newthread = function(L) {
let g = L.l_G;
let L1 = new lua_State();
- L.stack[L.top++] = L1;
+ L.stack[L.top++] = new lobject.TValue(CT.LUA_TTHREAD, L1);
assert(L.top <= L.ci.top, "stack overflow");
preinit_thread(L1, g);
L1.hookmask = L.hookmask;