From 517685f65d1c1881949ae57afb73d90cc188e7a8 Mon Sep 17 00:00:00 2001 From: Rochet2 Date: Fri, 19 Dec 2014 17:41:34 +0200 Subject: [PATCH] Fix messing up optional args and a warning --- GlobalMethods.h | 8 ++++---- ItemMethods.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/GlobalMethods.h b/GlobalMethods.h index fda2407..c328456 100644 --- a/GlobalMethods.h +++ b/GlobalMethods.h @@ -476,11 +476,11 @@ namespace LuaGlobalFunctions uint32 entry = Eluna::CHECKVAL(L, 1); uint32 ev = Eluna::CHECKVAL(L, 2); luaL_checktype(L, 3, LUA_TFUNCTION); - lua_pushvalue(L, 3); uint32 shots = Eluna::CHECKVAL(L, 4, 0); + lua_pushvalue(L, 3); int functionRef = luaL_ref(L, LUA_REGISTRYINDEX); - if (luaL_ref(L, LUA_REGISTRYINDEX) >= 0) + if (functionRef >= 0) E->Register(regtype, entry, ev, functionRef, shots); else luaL_argerror(L, 3, "unable to make a ref to function"); @@ -490,11 +490,11 @@ namespace LuaGlobalFunctions { uint32 ev = Eluna::CHECKVAL(L, 1); luaL_checktype(L, 2, LUA_TFUNCTION); - lua_pushvalue(L, 2); uint32 shots = Eluna::CHECKVAL(L, 3, 0); + lua_pushvalue(L, 2); int functionRef = luaL_ref(L, LUA_REGISTRYINDEX); - if (luaL_ref(L, LUA_REGISTRYINDEX) >= 0) + if (functionRef >= 0) E->Register(regtype, 0, ev, functionRef, shots); else luaL_argerror(L, 2, "unable to make a ref to function"); diff --git a/ItemMethods.h b/ItemMethods.h index dfc8792..10ffb12 100644 --- a/ItemMethods.h +++ b/ItemMethods.h @@ -204,7 +204,7 @@ namespace LuaItem //if (!test.empty()) //{ name += ' '; - name += suffix[(name != temp->Name1) ? locale : DEFAULT_LOCALE]; + name += suffix[(name != temp->Name1) ? locale : uint8(DEFAULT_LOCALE)]; /*}*/ } }