diff options
author | daurnimator <quae@daurnimator.com> | 2018-01-18 04:29:58 +1100 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2018-01-18 06:27:15 +1100 |
commit | 214dcf73833f7a29c58eef2b85d68ee3277039f0 (patch) | |
tree | e48560b5193f81e5dc4ba5ea4ff78004d274234b /src/llimits.js | |
parent | 2fec758ebe4205ffdbd955967890dbbe4b1869b9 (diff) | |
download | fengari-214dcf73833f7a29c58eef2b85d68ee3277039f0.tar.gz fengari-214dcf73833f7a29c58eef2b85d68ee3277039f0.tar.bz2 fengari-214dcf73833f7a29c58eef2b85d68ee3277039f0.zip |
src/: Start using lua_assert() instead of plain assert()
Diffstat (limited to 'src/llimits.js')
-rw-r--r-- | src/llimits.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/llimits.js b/src/llimits.js index 4a76bbe..bd48159 100644 --- a/src/llimits.js +++ b/src/llimits.js @@ -1,5 +1,19 @@ "use strict"; +const {luai_apicheck} = require("./luaconf.js"); + +const lua_assert = function(c) { + if (!c) throw Error("assertion failed"); +}; +module.exports.lua_assert = lua_assert; + +module.exports.luai_apicheck = luai_apicheck || function(l, e) { return lua_assert(e); }; + +const api_check = function(l, e, msg) { + return luai_apicheck(l, e && msg); +}; +module.exports.api_check = api_check; + const LUAI_MAXCCALLS = 200; module.exports.LUAI_MAXCCALLS = LUAI_MAXCCALLS; |