aboutsummaryrefslogtreecommitdiff
path: root/src/lauxlib.js
diff options
context:
space:
mode:
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