From 604ae7d072c94515c4724eb395b10c24789df348 Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Thu, 5 May 2016 19:23:46 -0700 Subject: [PATCH] move variable fetching from Lua out of min/max macros --- src/lua_mathlib.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lua_mathlib.c b/src/lua_mathlib.c index a55e3a0e4..d78cb23a4 100644 --- a/src/lua_mathlib.c +++ b/src/lua_mathlib.c @@ -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; }