Skip to content

Commit

Permalink
Updated GetAreaName with locale being an optional argument
Browse files Browse the repository at this point in the history
  • Loading branch information
Easelm committed Apr 26, 2014
1 parent bceccb8 commit 16d5197
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion GlobalMethods.h
Expand Up @@ -270,11 +270,15 @@ namespace LuaGlobalFunctions
int GetAreaName(lua_State* L)
{
uint32 areaOrZoneId = sEluna->CHECKVAL<uint32>(L, 1);
int locale = sEluna->CHECKVAL<int>(L, 2, DEFAULT_LOCALE);
if (locale < 0 || locale >= MAX_LOCALES)
return luaL_argerror(L, 2, "Invalid locale specified");

AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaOrZoneId);
if (!areaEntry)
return luaL_argerror(L, 1, "Invalid Area or Zone ID");

sEluna->Push(L, areaEntry->area_name[sWorld->GetDefaultDbcLocale()]);
sEluna->Push(L, areaEntry->area_name[locale]);
return 1;
}

Expand Down
2 changes: 1 addition & 1 deletion LuaFunctions.cpp
Expand Up @@ -64,7 +64,7 @@ void RegisterGlobals(lua_State* L)
lua_register(L, "GetGUIDLow", &LuaGlobalFunctions::GetGUIDLow); // GetGUIDLow(guid) - Returns GUIDLow (uint32) from guid (uint64 as string) UNDOCUMENTED
lua_register(L, "GetGUIDType", &LuaGlobalFunctions::GetGUIDType); // GetGUIDType(guid) - Returns Type (uint32) from guid (uint64 as string) UNDOCUMENTED
lua_register(L, "GetGUIDEntry", &LuaGlobalFunctions::GetGUIDEntry); // GetGUIDEntry(guid) - Returns Entry (uint32) from guid (uint64 as string), may be always 0 UNDOCUMENTED
lua_register(L, "GetAreaName", &LuaGlobalFunctions::GetAreaName); // GetAreaName(area or zone ID) - Returns area or zone (string) name by area or zone ID
lua_register(L, "GetAreaName", &LuaGlobalFunctions::GetAreaName); // GetAreaName(area or zone ID[, locale]) - Returns area or zone (string) name by area or zone ID. Locale is optional (Default = 0 (enUS))
lua_register(L, "bit_not", &LuaGlobalFunctions::bit_not); // bit_not(a) - Returns ~a UNDOCUMENTED
lua_register(L, "bit_xor", &LuaGlobalFunctions::bit_xor); // bit_xor(a, b) - Returns a ^ b UNDOCUMENTED
lua_register(L, "bit_rshift", &LuaGlobalFunctions::bit_rshift); // bit_rshift(a, b) - Returns a >> b UNDOCUMENTED
Expand Down

0 comments on commit 16d5197

Please sign in to comment.