diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c
index 14d7d7f3c87e9a2555ec12ed0d9aec29c5f29659..5e974675f191f7d4cf88983d42f22c35fc0fbed9 100644
--- a/src/lua_hudlib.c
+++ b/src/lua_hudlib.c
@@ -798,15 +798,15 @@ static int libd_drawLevelActNum(lua_State *L)
 {
 	INT32 x;
 	INT32 y;
-	INT32 flags;
 	UINT8 num;
+	INT32 flags;
 
 	HUDONLY
 
 	x = luaL_checkinteger(L, 1);
 	y = luaL_checkinteger(L, 2);
-	flags = luaL_optinteger(L, 3, 0);
-	num = luaL_checkinteger(L, 4);
+	num = luaL_checkinteger(L, 3);
+	flags = luaL_optinteger(L, 4, 0);
 
 	flags &= ~V_PARAMMASK; // Don't let crashes happen.