mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
change return type for luaL_(opt/check)boolean & use in conformance tests
This commit is contained in:
parent
a423e24dbf
commit
0767823618
3 changed files with 5 additions and 5 deletions
|
@ -25,8 +25,8 @@ LUALIB_API const char* luaL_optlstring(lua_State* L, int numArg, const char* def
|
|||
LUALIB_API double luaL_checknumber(lua_State* L, int numArg);
|
||||
LUALIB_API double luaL_optnumber(lua_State* L, int nArg, double def);
|
||||
|
||||
LUALIB_API bool luaL_checkboolean(lua_State* L, int narg);
|
||||
LUALIB_API bool luaL_optboolean(lua_State* L, int narg, bool def);
|
||||
LUALIB_API int luaL_checkboolean(lua_State* L, int narg);
|
||||
LUALIB_API int luaL_optboolean(lua_State* L, int narg, bool def);
|
||||
|
||||
LUALIB_API int luaL_checkinteger(lua_State* L, int numArg);
|
||||
LUALIB_API int luaL_optinteger(lua_State* L, int nArg, int def);
|
||||
|
|
|
@ -183,7 +183,7 @@ LUALIB_API double luaL_optnumber(lua_State* L, int narg, double def)
|
|||
return luaL_opt(L, luaL_checknumber, narg, def);
|
||||
}
|
||||
|
||||
LUALIB_API bool luaL_checkboolean(lua_State* L, int narg)
|
||||
LUALIB_API int luaL_checkboolean(lua_State* L, int narg)
|
||||
{
|
||||
// This checks specifically for boolean values, ignoring
|
||||
// all other truthy/falsy values. If the desired result
|
||||
|
@ -194,7 +194,7 @@ LUALIB_API bool luaL_checkboolean(lua_State* L, int narg)
|
|||
return lua_toboolean(L, narg);
|
||||
}
|
||||
|
||||
LUALIB_API bool luaL_optboolean(lua_State* L, int narg, bool def)
|
||||
LUALIB_API int luaL_optboolean(lua_State* L, int narg, bool def)
|
||||
{
|
||||
return luaL_opt(L, luaL_checkboolean, narg, def);
|
||||
}
|
||||
|
|
|
@ -524,7 +524,7 @@ TEST_CASE("Debugger")
|
|||
L,
|
||||
[](lua_State* L) -> int {
|
||||
int line = luaL_checkinteger(L, 1);
|
||||
bool enabled = lua_isboolean(L, 2) ? lua_toboolean(L, 2) : true;
|
||||
bool enabled = luaL_optboolean(L, 2, true);
|
||||
|
||||
lua_Debug ar = {};
|
||||
lua_getinfo(L, 1, "f", &ar);
|
||||
|
|
Loading…
Add table
Reference in a new issue