aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lauxlib.js2
-rw-r--r--src/lbaselib.js7
-rw-r--r--src/lcorolib.js9
-rw-r--r--src/lmathlib.js1
-rw-r--r--src/ltablib.js1
-rw-r--r--src/lua.js8
6 files changed, 15 insertions, 13 deletions
diff --git a/src/lauxlib.js b/src/lauxlib.js
index 1ee8900..f2cf220 100644
--- a/src/lauxlib.js
+++ b/src/lauxlib.js
@@ -514,7 +514,7 @@ if (typeof require === "function") {
let filename = lapi.lua_tostring(L, fnameindex).slice(1);
lapi.lua_pushstring(L, lua.to_luastring(`cannot ${what} ${lobject.jsstring(filename)}: ${serr}`));
lapi.lua_remove(L, fnameindex);
- return lua.thread_status.LUA_ERRFILE;
+ return lua.LUA_ERRFILE;
};
const getc = function(lf) {
diff --git a/src/lbaselib.js b/src/lbaselib.js
index 8b4e6a5..aa02908 100644
--- a/src/lbaselib.js
+++ b/src/lbaselib.js
@@ -6,7 +6,6 @@ const lua = require('./lua.js');
const lapi = require('./lapi.js');
const lauxlib = require('./lauxlib.js');
const lobject = require('./lobject.js');
-const TS = lua.thread_status;
const luaB_print = function(L) {
let n = lapi.lua_gettop(L); /* number of arguments */
@@ -222,7 +221,7 @@ const luaB_select = function(L) {
** ignored).
*/
const finishpcall = function(L, status, extra) {
- if (status !== TS.LUA_OK && status !== TS.LUA_YIELD) { /* error? */
+ if (status !== lua.LUA_OK && status !== lua.LUA_YIELD) { /* error? */
lapi.lua_pushboolean(L, 0); /* first result (false) */
lapi.lua_pushvalue(L, -2); /* error message */
return 2; /* return false, msg */
@@ -255,7 +254,7 @@ const luaB_xpcall = function(L) {
// TODO: does it overwrite the upvalue of the previous closure ?
const load_aux = function(L, status, envidx) {
- if (status === TS.LUA_OK) {
+ if (status === lua.LUA_OK) {
if (envidx !== 0) { /* 'env' parameter? */
lapi.lua_pushvalue(L, envidx); /* environment for loaded function */
if (!lapi.lua_setupvalue(L, -2, 1)) /* set it as 1st upvalue */
@@ -359,7 +358,7 @@ if (typeof require === "function") {
const luaB_dofile = function(L) {
let fname = lauxlib.luaL_optstring(L, 1, null);
lapi.lua_settop(L, 1);
- if (lauxlib.luaL_loadfile(L, fname) !== TS.LUA_OK)
+ if (lauxlib.luaL_loadfile(L, fname) !== lua.LUA_OK)
return lapi.lua_error(L);
lapi.lua_callk(L, 0, lua.LUA_MULTRET, 0, dofilecont);
return dofilecont(L, 0, 0);
diff --git a/src/lcorolib.js b/src/lcorolib.js
index a46df98..98eebac 100644
--- a/src/lcorolib.js
+++ b/src/lcorolib.js
@@ -9,7 +9,6 @@ const lstate = require('./lstate.js');
const ldo = require('./ldo.js');
const ldebug = require('./ldebug.js');
const lobject = require('./lobject.js');
-const TS = lua.thread_status;
const getco = function(L) {
let co = lapi.lua_tothread(L, 1);
@@ -23,14 +22,14 @@ const auxresume = function(L, co, narg) {
return -1; /* error flag */
}
- if (lapi.lua_status(co) === TS.LUA_OK && lapi.lua_gettop(co) === 0) {
+ if (lapi.lua_status(co) === lua.LUA_OK && lapi.lua_gettop(co) === 0) {
lapi.lua_pushliteral(L, "cannot resume dead coroutine");
return -1; /* error flag */
}
lapi.lua_xmove(L, co, narg);
let status = ldo.lua_resume(co, L, narg);
- if (status === TS.LUA_OK || status === TS.LUA_YIELD) {
+ if (status === lua.LUA_OK || status === lua.LUA_YIELD) {
let nres = lapi.lua_gettop(co);
if (!lapi.lua_checkstack(L, nres + 1)) {
lapi.lua_pop(co, nres); /* remove results anyway */
@@ -99,10 +98,10 @@ const luaB_costatus = function(L) {
if (L === co) lapi.lua_pushliteral(L, "running");
else {
switch (lapi.lua_status(co)) {
- case TS.LUA_YIELD:
+ case lua.LUA_YIELD:
lapi.lua_pushliteral(L, "suspended");
break;
- case TS.LUA_OK: {
+ case lua.LUA_OK: {
let ar = new lua.lua_Debug();
if (ldebug.lua_getstack(co, 0, ar) > 0) /* does it have frames? */
lapi.lua_pushliteral(L, "normal"); /* it is running */
diff --git a/src/lmathlib.js b/src/lmathlib.js
index 149bebd..9603d2e 100644
--- a/src/lmathlib.js
+++ b/src/lmathlib.js
@@ -11,7 +11,6 @@ const ldo = require('./ldo.js');
const ldebug = require('./ldebug.js');
const llimit = require('./llimit.js');
const luaconf = require('./luaconf.js');
-const TS = lua.thread_status;
var RNG = seedrandom();
diff --git a/src/ltablib.js b/src/ltablib.js
index 60b1554..51f9810 100644
--- a/src/ltablib.js
+++ b/src/ltablib.js
@@ -10,7 +10,6 @@ const ldo = require('./ldo.js');
const ldebug = require('./ldebug.js');
const llimit = require('./llimit.js');
const lobject = require('./lobject.js');
-const TS = lua.thread_status;
/*
diff --git a/src/lua.js b/src/lua.js
index fa25807..ec0b346 100644
--- a/src/lua.js
+++ b/src/lua.js
@@ -14,6 +14,11 @@ module.exports.FENGARI_VERSION_NUM = defs.FENGARI_VERSION_NUM;
module.exports.FENGARI_VERSION_RELEASE = defs.FENGARI_VERSION_RELEASE;
module.exports.LUA_AUTHORS = defs.LUA_AUTHORS;
module.exports.LUA_COPYRIGHT = defs.LUA_COPYRIGHT;
+module.exports.LUA_ERRERR = defs.thread_status.LUA_ERRERR;
+module.exports.LUA_ERRGCMM = defs.thread_status.LUA_ERRGCMM;
+module.exports.LUA_ERRMEM = defs.thread_status.LUA_ERRMEM;
+module.exports.LUA_ERRRUN = defs.thread_status.LUA_ERRRUN;
+module.exports.LUA_ERRSYNTAX = defs.thread_status.LUA_ERRSYNTAX;
module.exports.LUA_HOOKCALL = defs.LUA_HOOKCALL;
module.exports.LUA_HOOKCOUNT = defs.LUA_HOOKCOUNT;
module.exports.LUA_HOOKLINE = defs.LUA_HOOKLINE;
@@ -28,6 +33,7 @@ module.exports.LUA_MASKRET = defs.LUA_MASKRET;
module.exports.LUA_MINSTACK = defs.LUA_MINSTACK;
module.exports.LUA_MULTRET = defs.LUA_MULTRET;
module.exports.LUA_NUMTAGS = defs.LUA_NUMTAGS;
+module.exports.LUA_OK = defs.thread_status.LUA_OK;
module.exports.LUA_OPADD = defs.LUA_OPADD;
module.exports.LUA_OPBAND = defs.LUA_OPBAND;
module.exports.LUA_OPBNOT = defs.LUA_OPBNOT;
@@ -67,7 +73,7 @@ module.exports.LUA_VERSION_MINOR = defs.LUA_VERSION_MINOR;
module.exports.LUA_VERSION_NUM = defs.LUA_VERSION_NUM;
module.exports.LUA_VERSION_RELEASE = defs.LUA_VERSION_RELEASE;
module.exports.LUA_VERSUFFIX = defs.LUA_VERSUFFIX;
+module.exports.LUA_YIELD = defs.thread_status.LUA_YIELD;
module.exports.lua_Debug = defs.lua_Debug;
module.exports.lua_upvalueindex = defs.lua_upvalueindex;
-module.exports.thread_status = defs.thread_status;
module.exports.to_luastring = defs.to_luastring;