Fix linux warnings Implement #72

This commit is contained in:
Rochet2
2014-06-25 23:29:07 +03:00
committed by Foereaper
parent aa78932fd1
commit 580b3f7a25
17 changed files with 277 additions and 62 deletions

View File

@@ -104,7 +104,6 @@ namespace LuaAura
int SetStackAmount(lua_State* L, Aura* aura) int SetStackAmount(lua_State* L, Aura* aura)
{ {
int amount = Eluna::CHECKVAL<int>(L, 2); int amount = Eluna::CHECKVAL<int>(L, 2);
int duration = Eluna::CHECKVAL<int>(L, 2);
#ifdef MANGOS #ifdef MANGOS
aura->GetHolder()->SetStackAmount(amount); aura->GetHolder()->SetStackAmount(amount);
#else #else
@@ -113,7 +112,7 @@ namespace LuaAura
return 0; return 0;
} }
int Remove(lua_State* L, Aura* aura) int Remove(lua_State* /*L*/, Aura* aura)
{ {
#ifdef MANGOS #ifdef MANGOS
aura->GetHolder()->RemoveAura(aura->GetEffIndex()); aura->GetHolder()->RemoveAura(aura->GetEffIndex());

View File

@@ -9,7 +9,6 @@
namespace LuaCorpse namespace LuaCorpse
{ {
// GetOwnerGUID()
int GetOwnerGUID(lua_State* L, Corpse* corpse) int GetOwnerGUID(lua_State* L, Corpse* corpse)
{ {
#ifdef MANGOS #ifdef MANGOS
@@ -20,36 +19,31 @@ namespace LuaCorpse
return 1; return 1;
} }
// GetGhostTime()
int GetGhostTime(lua_State* L, Corpse* corpse) int GetGhostTime(lua_State* L, Corpse* corpse)
{ {
Eluna::Push(L, uint32(corpse->GetGhostTime())); Eluna::Push(L, uint32(corpse->GetGhostTime()));
return 1; return 1;
} }
// GetType()
int GetType(lua_State* L, Corpse* corpse) int GetType(lua_State* L, Corpse* corpse)
{ {
Eluna::Push(L, corpse->GetType()); Eluna::Push(L, corpse->GetType());
return 1; return 1;
} }
// ResetGhostTime() int ResetGhostTime(lua_State* /*L*/, Corpse* corpse)
int ResetGhostTime(lua_State* L, Corpse* corpse)
{ {
corpse->ResetGhostTime(); corpse->ResetGhostTime();
return 0; return 0;
} }
// SaveToDB() int SaveToDB(lua_State* /*L*/, Corpse* corpse)
int SaveToDB(lua_State* L, Corpse* corpse)
{ {
corpse->SaveToDB(); corpse->SaveToDB();
return 0; return 0;
} }
// DeleteBonesFromWorld() int DeleteBonesFromWorld(lua_State* /*L*/, Corpse* corpse)
int DeleteBonesFromWorld(lua_State* L, Corpse* corpse)
{ {
corpse->DeleteBonesFromWorld(); corpse->DeleteBonesFromWorld();
return 0; return 0;

View File

@@ -502,7 +502,7 @@ namespace LuaCreature
return 0; return 0;
} }
int SetInCombatWithZone(lua_State* L, Creature* creature) int SetInCombatWithZone(lua_State* /*L*/, Creature* creature)
{ {
creature->SetInCombatWithZone(); creature->SetInCombatWithZone();
return 0; return 0;
@@ -590,19 +590,19 @@ namespace LuaCreature
return 0; return 0;
} }
int Respawn(lua_State* L, Creature* creature) int Respawn(lua_State* /*L*/, Creature* creature)
{ {
creature->Respawn(); creature->Respawn();
return 0; return 0;
} }
int RemoveCorpse(lua_State* L, Creature* creature) int RemoveCorpse(lua_State* /*L*/, Creature* creature)
{ {
creature->RemoveCorpse(); creature->RemoveCorpse();
return 0; return 0;
} }
int MoveWaypoint(lua_State* L, Creature* creature) int MoveWaypoint(lua_State* /*L*/, Creature* creature)
{ {
#ifdef MANGOS #ifdef MANGOS
creature->GetMotionMaster()->MoveWaypoint(); creature->GetMotionMaster()->MoveWaypoint();
@@ -612,7 +612,7 @@ namespace LuaCreature
return 0; return 0;
} }
int CallAssistance(lua_State* L, Creature* creature) int CallAssistance(lua_State* /*L*/, Creature* creature)
{ {
creature->CallAssistance(); creature->CallAssistance();
return 0; return 0;
@@ -626,7 +626,7 @@ namespace LuaCreature
return 0; return 0;
} }
int FleeToGetAssistance(lua_State* L, Creature* creature) int FleeToGetAssistance(lua_State* /*L*/, Creature* creature)
{ {
creature->DoFleeToGetAssistance(); creature->DoFleeToGetAssistance();
return 0; return 0;
@@ -640,7 +640,7 @@ namespace LuaCreature
return 0; return 0;
} }
int SaveToDB(lua_State* L, Creature* creature) int SaveToDB(lua_State* /*L*/, Creature* creature)
{ {
creature->SaveToDB(); creature->SaveToDB();
return 0; return 0;

View File

@@ -97,7 +97,7 @@ namespace LuaGameObject
} }
/* OTHER */ /* OTHER */
int SaveToDB(lua_State* L, GameObject* go) int SaveToDB(lua_State* /*L*/, GameObject* go)
{ {
go->SaveToDB(); go->SaveToDB();
return 0; return 0;
@@ -133,7 +133,7 @@ namespace LuaGameObject
return 0; return 0;
} }
int RemoveEvents(lua_State* L, GameObject* go) int RemoveEvents(lua_State* /*L*/, GameObject* go)
{ {
sEluna->m_EventMgr->RemoveEvents(&go->m_Events); sEluna->m_EventMgr->RemoveEvents(&go->m_Events);
return 0; return 0;

View File

@@ -419,7 +419,7 @@ namespace LuaGlobalFunctions
return 0; return 0;
} }
int ReloadEluna(lua_State* L) int ReloadEluna(lua_State* /*L*/)
{ {
Eluna::reload = true; Eluna::reload = true;
return 0; return 0;
@@ -988,7 +988,7 @@ namespace LuaGlobalFunctions
return 0; return 0;
} }
int SaveAllPlayers(lua_State* L) int SaveAllPlayers(lua_State* /*L*/)
{ {
eObjectAccessor->SaveAllPlayers(); eObjectAccessor->SaveAllPlayers();
return 0; return 0;
@@ -1229,7 +1229,7 @@ namespace LuaGlobalFunctions
return 0; return 0;
} }
int RemoveOldCorpses(lua_State* L) int RemoveOldCorpses(lua_State* /*L*/)
{ {
eObjectAccessor->RemoveOldCorpses(); eObjectAccessor->RemoveOldCorpses();
return 0; return 0;

View File

@@ -201,13 +201,13 @@ namespace LuaGroup
return 1; return 1;
} }
int Disband(lua_State* L, Group* group) int Disband(lua_State* /*L*/, Group* group)
{ {
group->Disband(); group->Disband();
return 0; return 0;
} }
int ConvertToRaid(lua_State* L, Group* group) int ConvertToRaid(lua_State* /*L*/, Group* group)
{ {
group->ConvertToRaid(); group->ConvertToRaid();
return 0; return 0;

View File

@@ -138,7 +138,7 @@ namespace LuaGuild
return 0; return 0;
} }
int Disband(lua_State* L, Guild* guild) int Disband(lua_State* /*L*/, Guild* guild)
{ {
guild->Disband(); guild->Disband();
return 0; return 0;

View File

@@ -436,7 +436,8 @@ bool Eluna::OnItemUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targ
ENDCALL(); ENDCALL();
return true; return true;
} }
bool Eluna::OnItemGossip(Player* pPlayer, Item* pItem, SpellCastTargets const& targets)
bool Eluna::OnItemGossip(Player* pPlayer, Item* pItem, SpellCastTargets const& /*targets*/)
{ {
ENTRY_BEGIN(ItemGossipBindings, pItem->GetEntry(), GOSSIP_EVENT_ON_HELLO, return false); ENTRY_BEGIN(ItemGossipBindings, pItem->GetEntry(), GOSSIP_EVENT_ON_HELLO, return false);
pPlayer->PlayerTalkClass->ClearMenus(); pPlayer->PlayerTalkClass->ClearMenus();

View File

@@ -493,7 +493,7 @@ namespace LuaItem
return 1; return 1;
} }
int SaveToDB(lua_State* L, Item* item) int SaveToDB(lua_State* /*L*/, Item* item)
{ {
#ifdef MANGOS #ifdef MANGOS
item->SaveToDB(); item->SaveToDB();

View File

@@ -695,7 +695,7 @@ struct ElunaBind
{ {
} }
~ElunaBind() virtual ~ElunaBind()
{ {
Clear(); Clear();
} }

View File

@@ -1186,7 +1186,7 @@ template<typename T> const char* ElunaTemplate<T>::tname = NULL;
template<typename T> bool ElunaTemplate<T>::manageMemory = false; template<typename T> bool ElunaTemplate<T>::manageMemory = false;
#if (!defined(TBC) && !defined(CLASSIC)) #if (!defined(TBC) && !defined(CLASSIC))
// fix compile error about accessing vehicle destructor // fix compile error about accessing vehicle destructor
template<> int ElunaTemplate<Vehicle>::gcT(lua_State* L) template<> int ElunaTemplate<Vehicle>::gcT(lua_State* /*L*/)
{ {
// If assert fails, should code mem management here or flag Vehicles not mem managed // If assert fails, should code mem management here or flag Vehicles not mem managed
ASSERT(!manageMemory); ASSERT(!manageMemory);

View File

@@ -1303,7 +1303,7 @@ namespace LuaPlayer
/* OTHER */ /* OTHER */
#if (!defined(TBC) && !defined(CLASSIC)) #if (!defined(TBC) && !defined(CLASSIC))
int ResetPetTalents(lua_State* L, Player* player) int ResetPetTalents(lua_State* /*L*/, Player* player)
{ {
#ifdef MANGOS #ifdef MANGOS
Pet* pet = player->GetPet(); Pet* pet = player->GetPet();
@@ -1317,7 +1317,7 @@ namespace LuaPlayer
return 0; return 0;
} }
int ResetAchievements(lua_State* L, Player* player) int ResetAchievements(lua_State* /*L*/, Player* player)
{ {
#ifdef MANGOS #ifdef MANGOS
player->GetAchievementMgr().Reset(); player->GetAchievementMgr().Reset();
@@ -1362,7 +1362,7 @@ namespace LuaPlayer
#endif #endif
#endif #endif
int SaveToDB(lua_State* L, Player* player) int SaveToDB(lua_State* /*L*/, Player* player)
{ {
player->SaveToDB(); player->SaveToDB();
return 0; return 0;
@@ -1400,7 +1400,7 @@ namespace LuaPlayer
return 0; return 0;
} }
int CreateCorpse(lua_State* L, Player* player) int CreateCorpse(lua_State* /*L*/, Player* player)
{ {
player->CreateCorpse(); player->CreateCorpse();
return 0; return 0;
@@ -1444,7 +1444,7 @@ namespace LuaPlayer
return 0; return 0;
} }
int SendSpiritResurrect(lua_State* L, Player* player) int SendSpiritResurrect(lua_State* /*L*/, Player* player)
{ {
player->GetSession()->SendSpiritResurrect(); player->GetSession()->SendSpiritResurrect();
return 0; return 0;
@@ -1503,7 +1503,7 @@ namespace LuaPlayer
return 0; return 0;
} }
int RemoveFromBattlegroundRaid(lua_State* L, Player* player) int RemoveFromBattlegroundRaid(lua_State* /*L*/, Player* player)
{ {
#ifdef MANGOS #ifdef MANGOS
player->RemoveFromBattleGroundRaid(); player->RemoveFromBattleGroundRaid();
@@ -1609,13 +1609,13 @@ namespace LuaPlayer
return 0; return 0;
} }
int KillPlayer(lua_State* L, Player* player) int KillPlayer(lua_State* /*L*/, Player* player)
{ {
player->KillPlayer(); player->KillPlayer();
return 0; return 0;
} }
int RemoveFromGroup(lua_State* L, Player* player) int RemoveFromGroup(lua_State* /*L*/, Player* player)
{ {
if (!player->GetGroup()) if (!player->GetGroup())
return 0; return 0;
@@ -1659,7 +1659,7 @@ namespace LuaPlayer
return 0; return 0;
} }
int ClearComboPoints(lua_State* L, Player* player) int ClearComboPoints(lua_State* /*L*/, Player* player)
{ {
player->ClearComboPoints(); player->ClearComboPoints();
return 0; return 0;
@@ -1777,13 +1777,13 @@ namespace LuaPlayer
return 0; return 0;
} }
int ToggleDND(lua_State* L, Player* player) int ToggleDND(lua_State* /*L*/, Player* player)
{ {
player->ToggleDND(); player->ToggleDND();
return 0; return 0;
} }
int ToggleAFK(lua_State* L, Player* player) int ToggleAFK(lua_State* /*L*/, Player* player)
{ {
player->ToggleAFK(); player->ToggleAFK();
return 0; return 0;
@@ -1874,7 +1874,7 @@ namespace LuaPlayer
} }
#endif #endif
int AdvanceSkillsToMax(lua_State* L, Player* player) int AdvanceSkillsToMax(lua_State* /*L*/, Player* player)
{ {
player->UpdateSkillsToMaxSkillsForLevel(); player->UpdateSkillsToMaxSkillsForLevel();
return 0; return 0;
@@ -1999,7 +1999,7 @@ namespace LuaPlayer
return 0; return 0;
} }
int ResetAllCooldowns(lua_State* L, Player* player) int ResetAllCooldowns(lua_State* /*L*/, Player* player)
{ {
player->RemoveAllSpellCooldown(); player->RemoveAllSpellCooldown();
return 0; return 0;
@@ -2087,7 +2087,7 @@ namespace LuaPlayer
return 0; return 0;
} }
int KickPlayer(lua_State* L, Player* player) int KickPlayer(lua_State* /*L*/, Player* player)
{ {
player->GetSession()->KickPlayer(); player->GetSession()->KickPlayer();
return 0; return 0;
@@ -2138,7 +2138,7 @@ namespace LuaPlayer
return 0; return 0;
} }
int GossipComplete(lua_State* L, Player* player) int GossipComplete(lua_State* /*L*/, Player* player)
{ {
#ifdef MANGOS #ifdef MANGOS
player->PlayerTalkClass->CloseGossip(); player->PlayerTalkClass->CloseGossip();
@@ -2161,7 +2161,7 @@ namespace LuaPlayer
return 0; return 0;
} }
int GossipClearMenu(lua_State* L, Player* player) int GossipClearMenu(lua_State* /*L*/, Player* player)
{ {
player->PlayerTalkClass->ClearMenus(); player->PlayerTalkClass->ClearMenus();
return 0; return 0;
@@ -2248,7 +2248,7 @@ namespace LuaPlayer
return 0; return 0;
} }
int SpawnBones(lua_State* L, Player* player) int SpawnBones(lua_State* /*L*/, Player* player)
{ {
player->SpawnCorpseBones(); player->SpawnCorpseBones();
return 0; return 0;

View File

@@ -112,13 +112,13 @@ namespace LuaSpell
return 0; return 0;
} }
int cancel(lua_State* L, Spell* spell) int cancel(lua_State* /*L*/, Spell* spell)
{ {
spell->cancel(); spell->cancel();
return 0; return 0;
} }
int Finish(lua_State* L, Spell* spell) int Finish(lua_State* /*L*/, Spell* spell)
{ {
spell->finish(); spell->finish();
return 0; return 0;

View File

@@ -601,7 +601,7 @@ namespace LuaUnit
type = POWER_MANA; type = POWER_MANA;
} }
} }
else if (type < 0 || type >= POWER_ALL) else if (type < 0 || type >= int(MAX_POWERS))
return luaL_argerror(L, 2, "valid Powers expected"); return luaL_argerror(L, 2, "valid Powers expected");
Eluna::Push(L, unit->GetPower((Powers)type)); Eluna::Push(L, unit->GetPower((Powers)type));
@@ -640,7 +640,7 @@ namespace LuaUnit
type = POWER_MANA; type = POWER_MANA;
} }
} }
else if (type < 0 || type >= POWER_ALL) else if (type < 0 || type >= int(MAX_POWERS))
return luaL_argerror(L, 2, "valid Powers expected"); return luaL_argerror(L, 2, "valid Powers expected");
Eluna::Push(L, unit->GetMaxPower((Powers)type)); Eluna::Push(L, unit->GetMaxPower((Powers)type));
@@ -850,11 +850,13 @@ namespace LuaUnit
return 1; return 1;
} }
/*
int GetVehicle(lua_State* L, Unit* unit) int GetVehicle(lua_State* L, Unit* unit)
{ {
// Eluna::Push(L, unit->GetVehicle()); Eluna::Push(L, unit->GetVehicle());
return 1; return 1;
} }
*/
int GetCritterGUID(lua_State* L, Unit* unit) int GetCritterGUID(lua_State* L, Unit* unit)
{ {
@@ -1198,7 +1200,7 @@ namespace LuaUnit
}*/ }*/
/* OTHER */ /* OTHER */
int ClearThreatList(lua_State* L, Unit* unit) int ClearThreatList(lua_State* /*L*/, Unit* unit)
{ {
unit->getThreatManager().clearReferences(); unit->getThreatManager().clearReferences();
return 0; return 0;
@@ -1212,7 +1214,7 @@ namespace LuaUnit
return 0; return 0;
} }
int Dismount(lua_State* L, Unit* unit) int Dismount(lua_State* /*L*/, Unit* unit)
{ {
if (unit->IsMounted()) if (unit->IsMounted())
{ {
@@ -1275,7 +1277,7 @@ namespace LuaUnit
// unit->GetMotionMaster()->Clear(); // all // unit->GetMotionMaster()->Clear(); // all
// } // }
int MoveStop(lua_State* L, Unit* unit) int MoveStop(lua_State* /*L*/, Unit* unit)
{ {
unit->StopMoving(); unit->StopMoving();
return 0; return 0;
@@ -1295,7 +1297,7 @@ namespace LuaUnit
return 0; return 0;
} }
int MoveIdle(lua_State* L, Unit* unit) int MoveIdle(lua_State* /*L*/, Unit* unit)
{ {
unit->GetMotionMaster()->MoveIdle(); unit->GetMotionMaster()->MoveIdle();
return 0; return 0;
@@ -1314,7 +1316,7 @@ namespace LuaUnit
return 0; return 0;
} }
int MoveHome(lua_State* L, Unit* unit) int MoveHome(lua_State* /*L*/, Unit* unit)
{ {
unit->GetMotionMaster()->MoveTargetedHome(); unit->GetMotionMaster()->MoveTargetedHome();
return 0; return 0;
@@ -1338,7 +1340,7 @@ namespace LuaUnit
return 0; return 0;
} }
int MoveConfused(lua_State* L, Unit* unit) int MoveConfused(lua_State* /*L*/, Unit* unit)
{ {
unit->GetMotionMaster()->MoveConfused(); unit->GetMotionMaster()->MoveConfused();
return 0; return 0;
@@ -1415,7 +1417,7 @@ namespace LuaUnit
return 0; return 0;
} }
int DeMorph(lua_State* L, Unit* unit) int DeMorph(lua_State* /*L*/, Unit* unit)
{ {
unit->DeMorph(); unit->DeMorph();
return 0; return 0;
@@ -1445,7 +1447,7 @@ namespace LuaUnit
return 0; return 0;
} }
int ClearInCombat(lua_State* L, Unit* unit) int ClearInCombat(lua_State* /*L*/, Unit* unit)
{ {
unit->ClearInCombat(); unit->ClearInCombat();
return 0; return 0;
@@ -1522,7 +1524,7 @@ namespace LuaUnit
return 0; return 0;
} }
int RemoveAllAuras(lua_State* L, Unit* unit) int RemoveAllAuras(lua_State* /*L*/, Unit* unit)
{ {
unit->RemoveAllAuras(); unit->RemoveAllAuras();
return 0; return 0;
@@ -1577,7 +1579,7 @@ namespace LuaUnit
return 0; return 0;
} }
int RemoveEvents(lua_State* L, Unit* unit) int RemoveEvents(lua_State* /*L*/, Unit* unit)
{ {
sEluna->m_EventMgr->RemoveEvents(&unit->m_Events); sEluna->m_EventMgr->RemoveEvents(&unit->m_Events);
return 0; return 0;

View File

@@ -0,0 +1,207 @@
--
-- Copyright (C) 2010 - 2014 Eluna Lua Engine <http://emudevs.com/>
-- This program is free software licensed under GPL version 3
-- Please see the included DOCS/LICENSE.md for more information
--
-- Functions with parameters or multiple return values are not supported
-- These functions should return static data
local T = {
}
-- Global
table.insert(T, "GetLuaEngine")
table.insert(T, "GetCoreName")
table.insert(T, "GetCoreVersion")
table.insert(T, "GetCoreExpansion")
T.Object = {}
table.insert(T.Object, "GetEntry")
table.insert(T.Object, "GetGUID")
table.insert(T.Object, "GetGUIDLow")
table.insert(T.Object, "GetTypeId")
T.WorldObject = {}
table.insert(T.WorldObject, "GetName")
-- T.Unit = {}
T.Player = {}
table.insert(T.Player, "GetGMRank")
table.insert(T.Player, "GetAccountId")
table.insert(T.Player, "GetAccountName")
table.insert(T.Player, "GetPlayerIP")
table.insert(T.Player, "GetDbLocaleIndex")
table.insert(T.Player, "GetDbcLocale")
T.Creature = {}
table.insert(T.Creature, "GetCorpseDelay")
table.insert(T.Creature, "GetScriptId")
table.insert(T.Creature, "GetAIName")
table.insert(T.Creature, "GetScriptName")
table.insert(T.Creature, "IsWorldBoss")
table.insert(T.Creature, "IsRacialLeader")
table.insert(T.Creature, "IsCivilian")
table.insert(T.Creature, "IsGuard")
table.insert(T.Creature, "IsElite")
T.Item = {}
table.insert(T.Item, "GetClass")
table.insert(T.Item, "GetSubClass")
table.insert(T.Item, "GetName")
table.insert(T.Item, "GetDisplayId")
table.insert(T.Item, "GetQuality")
table.insert(T.Item, "GetBuyCount")
table.insert(T.Item, "GetBuyPrice")
table.insert(T.Item, "GetSellPrice")
table.insert(T.Item, "GetInventoryType")
table.insert(T.Item, "GetAllowableClass")
table.insert(T.Item, "GetAllowableRace")
table.insert(T.Item, "GetItemLevel")
table.insert(T.Item, "GetRequiredLevel")
if (GetCoreExpansion() == 2) then
table.insert(T.Item, "GetStatsCount")
end
table.insert(T.Item, "GetRandomProperty")
if (GetCoreExpansion() ~= 0) then
table.insert(T.Item, "GetRandomSuffix")
end
table.insert(T.Item, "GetItemSet")
table.insert(T.Item, "GetBagSize")
table.insert(T.Item, "IsBag")
if (GetCoreExpansion() ~= 0) then
table.insert(T.Item, "IsCurrencyToken")
end
table.insert(T.Item, "IsPotion")
if (GetCoreExpansion() ~= 3) then
table.insert(T.Item, "IsWeaponVellum")
table.insert(T.Item, "IsArmorVellum")
end
table.insert(T.Item, "IsConjuredConsumable")
T.Aura = {}
table.insert(T.Aura, "GetCaster")
table.insert(T.Aura, "GetCasterGUID")
table.insert(T.Aura, "GetAuraId")
table.insert(T.Aura, "GetOwner")
T.Spell = {}
table.insert(T.Spell, "GetCaster")
table.insert(T.Spell, "GetCastTime")
table.insert(T.Spell, "GetEntry")
table.insert(T.Spell, "GetDuration")
table.insert(T.Spell, "GetPowerCost")
table.insert(T.Spell, "GetTargetDest")
table.insert(T.Spell, "GetTarget")
T.Quest = {}
table.insert(T.Quest, "GetId")
table.insert(T.Quest, "GetLevel")
table.insert(T.Quest, "GetMinLevel")
table.insert(T.Quest, "GetNextQuestId")
table.insert(T.Quest, "GetPrevQuestId")
table.insert(T.Quest, "GetNextQuestInChain")
table.insert(T.Quest, "GetFlags")
table.insert(T.Quest, "GetType")
table.insert(T.Quest, "HasFlag")
if (GetCoreExpansion() ~= 0) then
table.insert(T.Quest, "IsDaily")
end
table.insert(T.Quest, "IsRepeatable")
T.Group = {}
table.insert(T.Group, "GetGUID")
T.Guild = {}
table.insert(T.Guild, "GetId")
table.insert(T.Guild, "GetName")
T.Vehicle = {}
table.insert(T.Vehicle, "GetOwner")
table.insert(T.Vehicle, "GetEntry")
T.QueryResult = {}
table.insert(T.QueryResult, "GetColumnCount")
table.insert(T.QueryResult, "GetRowCount")
T.WorldPacket = {}
table.insert(T.WorldPacket, "GetSize")
T.Map = {}
table.insert(T.Map, "GetName")
table.insert(T.Map, "GetDifficulty")
table.insert(T.Map, "GetInstanceId")
table.insert(T.Map, "GetMapId")
if (GetCoreExpansion() ~= 0) then
table.insert(T.Map, "IsArena")
end
table.insert(T.Map, "IsBattleground")
table.insert(T.Map, "IsDungeon")
table.insert(T.Map, "IsHeroic")
table.insert(T.Map, "IsRaid")
T.Corpse = {}
table.insert(T.Corpse, "GetOwnerGUID")
T.Weather = {}
table.insert(T.Weather, "GetZoneId")
-- T.AuctionHouseObject
-- This is used for global functions
-- weak keys for table so data available for GC when cant be used anymore
local GFT = {}
do
local GFTM = {
__mode = "k",
}
setmetatable(GFT, GFTM)
end
for typeName, tbl in pairs(T) do
if (type(typeName) == "number" and type(tbl) == "string") then
-- Global function
assert(_G[tbl], "_G["..tostring(tbl).."] doesnt exist")
local temp = _G[tbl]
_G[tbl] = function()
if (GFT[tbl] ~= nil) then
return GFT[tbl]
end
GFT[tbl] = temp()
return GFT[tbl]
end
elseif (type(typeName) == "string" and type(tbl) == "table") then
-- A method
assert(_G[typeName], "_G["..tostring(typeName).."] doesnt exist")
for _, funcName in ipairs(tbl) do
assert(_G[typeName][funcName], "_G["..tostring(typeName).."]["..tostring(funcName).."] doesnt exist")
-- Temporarily save the actual Get function with different name
local temp = _G[typeName][funcName]
-- weak keys for table so data available for GC when cant be used anymore
local FT = {}
do
local FTM = {
__mode = "k",
}
setmetatable(FT, FTM)
end
-- Check cache table for reference, return it if exists else fetch, save and return
_G[typeName][funcName] = function(self)
if (FT[self] ~= nil) then
return FT[self]
end
FT[self] = temp(self)
return FT[self]
end
end
else
error("_G["..tostring(typeName).."] = "..tostring(tbl).." is not valid k,v pair for Get cache system")
end
end

View File

@@ -1,3 +1,9 @@
--
-- Copyright (C) 2010 - 2014 Eluna Lua Engine <http://emudevs.com/>
-- This program is free software licensed under GPL version 3
-- Please see the included DOCS/LICENSE.md for more information
--
-- Set correct require paths -- Set correct require paths
package.path = package.path.."lua_scripts\\?;lua_scripts\\?.dll;lua_scripts\\?.lua;lua_scripts\\extensions\\?;lua_scripts\\extensions\\?.dll;lua_scripts\\extensions\\?.lua" package.path = package.path.."lua_scripts\\?;lua_scripts\\?.dll;lua_scripts\\?.lua;lua_scripts\\extensions\\?;lua_scripts\\extensions\\?.dll;lua_scripts\\extensions\\?.lua"
-- Randomize random -- Randomize random

View File

@@ -1,3 +1,9 @@
--
-- Copyright (C) 2010 - 2014 Eluna Lua Engine <http://emudevs.com/>
-- This program is free software licensed under GPL version 3
-- Please see the included DOCS/LICENSE.md for more information
--
--[[ --[[
Functions: Functions:
Object:GetData(instance) -- returns a table unique for the object or it's instance Object:GetData(instance) -- returns a table unique for the object or it's instance