From 04a7b7322446eae0f5da66bedc1e262a7d83419d Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Thu, 2 Feb 2017 08:30:20 +0100 Subject: readHeader --- src/lstate.js | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) (limited to 'src/lstate.js') diff --git a/src/lstate.js b/src/lstate.js index b0002c3..979b89c 100644 --- a/src/lstate.js +++ b/src/lstate.js @@ -1,32 +1,24 @@ /*jshint esversion: 6 */ "use strict"; +const thread_status = require('./lua.js').thread_status; + class lua_State { constructor() { - // CommonHeader; - // unsigned short nci; /* number of items in 'ci' list */ - // lu_byte status; - // StkId top; /* first free slot in the stack */ - // global_State *l_G; - // CallInfo *ci; /* call info for current function */ - // const Instruction *oldpc; /* last pc traced */ - // StkId stack_last; /* last free slot in the stack */ - // StkId stack; /* stack base */ - // UpVal *openupval; /* list of open upvalues in this stack */ - // GCObject *gclist; - // struct lua_State *twups; list of threads with open upvalues - // struct lua_longjmp *errorJmp; /* current error recover point */ - // CallInfo base_ci; /* CallInfo for first level (C calling Lua) */ - // volatile lua_Hook hook; - // ptrdiff_t errfunc; /* current error handling function (stack index) */ - // int stacksize; - // int basehookcount; - // int hookcount; - // unsigned short nny; /* number of non-yieldable calls in stack */ - // unsigned short nCcalls; /* number of nested C calls */ - // l_signalT hookmask; - // lu_byte allowhook; + this.next = null; + this.stack = null; + this.ci = null; + this.nci = 0; + this.stacksize = 0; + this.twups = [this]; + this.errorJmp = null; + this.hook = null; + this.allowhook = true; + this.openupval = null; + this.nny = 1; + this.status = thread_status.LUA_OK; + this.errfunc = 0; } } -- cgit v1.2.3-54-g00ecf