From 214dcf73833f7a29c58eef2b85d68ee3277039f0 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Thu, 18 Jan 2018 04:29:58 +1100 Subject: src/: Start using lua_assert() instead of plain assert() --- src/llimits.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/llimits.js') 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; -- cgit v1.2.3-54-g00ecf