#define lua_isnumber(L, n) (lua_isnumber((L), (n)) == 1)
#define lua_toboolean(L, n) (lua_toboolean((L), (n)) == 1)
#define lua_pushboolean(L, b) lua_pushboolean((L), (b) ? 1 : 0)
+#define lua_isinteger(L, n) (lua_isinteger((L), (n)) == 1)
#define DLUA_TABLE_STRING(n, val) { .name = (n),\
.type = DLUA_TABLE_VALUE_STRING, .v.s = (val) }
if (dlua_pcall(script->L, LUA_SCRIPT_INIT_FN, 0, 1, error_r) < 0)
return -1;
- if (lua_isinteger(script->L, -1) == 1) {
+ if (lua_isinteger(script->L, -1)) {
ret = lua_tointeger(script->L, -1);
if (ret != 0)
*error_r = "Script init failed";
/* check lua_tointegerx against top-of-stack item */
static void check_tointegerx_compat(lua_State *L, int expected_isnum,
- int expected_isint,
+ bool expected_isint,
lua_Integer expected_value)
{
lua_Integer value;
for (i = 0; i < N_ELEMENTS(str_tests); i++) {
lua_pushstring(script->L, str_tests[i].input);
- check_tointegerx_compat(script->L, str_tests[i].isnum, 0,
+ check_tointegerx_compat(script->L, str_tests[i].isnum, FALSE,
str_tests[i].output);
}
for (i = 0; i < N_ELEMENTS(num_tests); i++) {
- int isint;
+ bool isint;
/* See lua_isinteger() comment in dlua-compat.h */
#if LUA_VERSION_NUM == 503
- isint = 0;
+ isint = FALSE;
#else
- isint = num_tests[i].isnum;
+ isint = (num_tests[i].isnum == 1);
#endif
lua_pushnumber(script->L, num_tests[i].input);
for (i = 0; i < N_ELEMENTS(int_tests); i++) {
lua_pushinteger(script->L, int_tests[i].input);
- check_tointegerx_compat(script->L, 1, 1,
+ check_tointegerx_compat(script->L, 1, TRUE,
int_tests[i].output);
}