summaryrefslogtreecommitdiff
path: root/src/lapi.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-12 14:52:14 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-15 18:56:25 +1000
commit4a0aa6eecf10432453c22031c247cf24819f1040 (patch)
tree542bf773168d6af2069a91125447801a5576d2c6 /src/lapi.js
parent424a3604dd90a40773e3434450bb5cb685962926 (diff)
downloadfengari-4a0aa6eecf10432453c22031c247cf24819f1040.tar.gz
fengari-4a0aa6eecf10432453c22031c247cf24819f1040.tar.bz2
fengari-4a0aa6eecf10432453c22031c247cf24819f1040.zip
Add facility for a user provided (state-global) native error handler
Diffstat (limited to 'src/lapi.js')
-rw-r--r--src/lapi.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lapi.js b/src/lapi.js
index f56fc81..c0e619b 100644
--- a/src/lapi.js
+++ b/src/lapi.js
@@ -36,6 +36,12 @@ const lua_atpanic = function(L, panicf) {
return old;
};
+const lua_atnativeerror = function(L, errorf) {
+ let old = L.l_G.atnativeerror;
+ L.l_G.atnativeerror = errorf;
+ return old;
+};
+
// Return value for idx on stack
const index2addr = function(L, idx) {
let ci = L.ci;
@@ -1104,6 +1110,7 @@ module.exports.index2addr_ = index2addr_;
module.exports.lua_absindex = lua_absindex;
module.exports.lua_arith = lua_arith;
module.exports.lua_atpanic = lua_atpanic;
+module.exports.lua_atnativeerror = lua_atnativeerror;
module.exports.lua_call = lua_call;
module.exports.lua_callk = lua_callk;
module.exports.lua_checkstack = lua_checkstack;