From 9d6afeba223c22163928557c69a102877223d3bd Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Wed, 15 Feb 2017 22:13:01 +0100 Subject: Everything need to make luaL_newstate work, lua_pushnil test --- src/lauxlib.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/lauxlib.js (limited to 'src/lauxlib.js') 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 -- cgit v1.2.3-54-g00ecf