Functions that take a boolean argument now properly type-check for it.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2017-08-14 22:56:20 -03:00
parent fea9f82cfa
commit fee157b6b9
21 changed files with 50 additions and 42 deletions
+6
View File
@@ -171,6 +171,12 @@ bool luax_toboolean(lua_State *L, int idx)
return (lua_toboolean(L, idx) != 0);
}
bool luax_checkboolean(lua_State *L, int idx)
{
luaL_checktype(L, idx, LUA_TBOOLEAN);
return luax_toboolean(L, idx);
}
void luax_pushboolean(lua_State *L, bool b)
{
lua_pushboolean(L, b ? 1 : 0);