From 91323c6e0126a744f6498a03ba82274011babe7b Mon Sep 17 00:00:00 2001 From: daurnimator Date: Wed, 14 Aug 2019 22:48:11 +1000 Subject: [PATCH] src/{llimits,luaconf}.js: remove luai_apicheck The definition was inverted and the correct error message wasn't thrown. As we can't match the C-style definition from Lua and that it wasn't very configurable, it makes sense to remove it. --- src/llimits.js | 6 +----- src/luaconf.js | 5 ----- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/llimits.js b/src/llimits.js index 2e7b892..4f2b3f3 100644 --- a/src/llimits.js +++ b/src/llimits.js @@ -1,16 +1,12 @@ "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); + if (!e) throw Error(msg); }; module.exports.api_check = api_check; diff --git a/src/luaconf.js b/src/luaconf.js index dbdcf9a..5fb91cd 100644 --- a/src/luaconf.js +++ b/src/luaconf.js @@ -172,10 +172,6 @@ const lua_getlocaledecpoint = function() { return 46 /* '.'.charCodeAt(0) */; }; -const luai_apicheck = function(l, e) { - if (!e) throw Error(e); -}; - /* @@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. */ @@ -220,4 +216,3 @@ module.exports.lua_getlocaledecpoint = lua_getlocaledecpoint; module.exports.lua_integer2str = lua_integer2str; module.exports.lua_number2str = lua_number2str; module.exports.lua_numbertointeger = lua_numbertointeger; -module.exports.luai_apicheck = luai_apicheck;