summaryrefslogtreecommitdiff
path: root/src/lauxlib.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-02-15 22:13:01 +0100
committerBenoit Giannangeli <giann008@gmail.com>2017-02-15 22:19:14 +0100
commit9d6afeba223c22163928557c69a102877223d3bd (patch)
tree481efe9bfaf1095792ca1612603ef3505352d1f8 /src/lauxlib.js
parent43474e4c411709e3c1ab1b1d13283d2bc4789d1d (diff)
downloadfengari-9d6afeba223c22163928557c69a102877223d3bd.tar.gz
fengari-9d6afeba223c22163928557c69a102877223d3bd.tar.bz2
fengari-9d6afeba223c22163928557c69a102877223d3bd.zip
Everything need to make luaL_newstate work, lua_pushnil test
Diffstat (limited to 'src/lauxlib.js')
-rw-r--r--src/lauxlib.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/lauxlib.js b/src/lauxlib.js
new file mode 100644
index 0000000..3ff346e
--- /dev/null
+++ b/src/lauxlib.js
@@ -0,0 +1,21 @@
+/*jshint esversion: 6 */
+"use strict";
+
+const assert = require('assert');
+
+const lstate = require('./lstate.js');
+const lapi = require('./lapi.js');
+
+const panic = function(L) {
+ console.log(`PANIC: unprotected error in call to Lua API (...)`);
+ return 0;
+}
+
+const luaL_newstate = function() {
+ let L = lstate.lua_newstate();
+ if (L) lapi.lua_atpanic(L, panic);
+ return L;
+};
+
+
+module.exports.luaL_newstate = luaL_newstate; \ No newline at end of file