summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/tests.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/tests.js b/tests/tests.js
index 4170f67..75e5e19 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -24,8 +24,11 @@ const toByteCode = function (luaCode) {
const getState = function(luaCode) {
let L = lauxlib.luaL_newstate();
+ if (!L)
+ throw Error("unable to create lua_State");
- lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode));
+ if (lauxlib.luaL_loadstring(L, lua.to_luastring(luaCode)) !== lua.LUA_OK)
+ return Error(lua.lua_tojsstring(L, -1));
return L;
};