mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +02:00
CLuaInstance: Add missed library function _luaL_checkbool()
This commit is contained in:
@@ -350,6 +350,24 @@ CLuaInstance::~CLuaInstance()
|
||||
}
|
||||
}
|
||||
|
||||
/* Ported by Benny Chen, http://www.bennychen.cn/tag/lual_checkbool/ */
|
||||
bool CLuaInstance::_luaL_checkbool(lua_State *L, int numArg)
|
||||
{
|
||||
bool b = false;
|
||||
if (lua_isboolean(L, numArg))
|
||||
b = lua_toboolean(L, numArg);
|
||||
else {
|
||||
lua_Debug ar;
|
||||
lua_getstack(L, 0, &ar);
|
||||
lua_getinfo(L, "n", &ar);
|
||||
luaL_error(L, "bad argument #%d to '%s' (%s expected, got %s)\n",
|
||||
numArg-1, ar.name,
|
||||
lua_typename(L, LUA_TBOOLEAN),
|
||||
lua_typename(L, lua_type(L, numArg)));
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
void CLuaInstance::functionDeprecated(lua_State *L, const char* oldFunc, const char* newFunc)
|
||||
{
|
||||
lua_Debug ar;
|
||||
|
@@ -177,6 +177,7 @@ private:
|
||||
lua_State* lua;
|
||||
void registerFunctions();
|
||||
|
||||
static bool _luaL_checkbool(lua_State *L, int numArg);
|
||||
static void functionDeprecated(lua_State *L, const char* oldFunc, const char* newFunc);
|
||||
static lua_Unsigned checkMagicMask(lua_Unsigned &col);
|
||||
|
||||
|
Reference in New Issue
Block a user