move variable fetching from Lua out of min/max macros

This commit is contained in:
Inuyasha 2016-05-05 19:23:46 -07:00
parent c8cdded81e
commit 604ae7d072

View file

@ -32,13 +32,17 @@ static int lib_abs(lua_State *L)
static int lib_min(lua_State *L)
{
lua_pushinteger(L, min(luaL_checkinteger(L, 1), luaL_checkinteger(L, 2)));
int a = luaL_checkinteger(L, 1);
int b = luaL_checkinteger(L, 2);
lua_pushinteger(L, min(a,b));
return 1;
}
static int lib_max(lua_State *L)
{
lua_pushinteger(L, max(luaL_checkinteger(L, 1), luaL_checkinteger(L, 2)));
int a = luaL_checkinteger(L, 1);
int b = luaL_checkinteger(L, 2);
lua_pushinteger(L, max(a,b));
return 1;
}