Change Eluna to a global variable

Remove Eluna* from being passed. You can now get it through Eluna::GetEluna(L)
Change function call cleanup to lua_settop instead of manual loop
Explicitly delete the copy constructor and copy assignment operators
This commit is contained in:
Rochet2
2017-03-19 15:48:48 +02:00
parent 8d3433f4b5
commit b7c379a42c
23 changed files with 990 additions and 976 deletions

View File

@@ -31,7 +31,7 @@ namespace LuaObject
* @param uint32 flag : the flag to check for in the flags data
* @return bool hasFlag
*/
int HasFlag(Eluna* /*E*/, lua_State* L, Object* obj)
int HasFlag(lua_State* L, Object* obj)
{
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
uint32 flag = Eluna::CHECKVAL<uint32>(L, 3);
@@ -45,7 +45,7 @@ namespace LuaObject
*
* @return bool inWorld
*/
int IsInWorld(Eluna* /*E*/, lua_State* L, Object* obj)
int IsInWorld(lua_State* L, Object* obj)
{
Eluna::Push(L, obj->IsInWorld());
return 1;
@@ -57,7 +57,7 @@ namespace LuaObject
* @param uint16 index
* @return int32 value
*/
int GetInt32Value(Eluna* /*E*/, lua_State* L, Object* obj)
int GetInt32Value(lua_State* L, Object* obj)
{
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
Eluna::Push(L, obj->GetInt32Value(index));
@@ -70,7 +70,7 @@ namespace LuaObject
* @param uint16 index
* @return uint32 value
*/
int GetUInt32Value(Eluna* /*E*/, lua_State* L, Object* obj)
int GetUInt32Value(lua_State* L, Object* obj)
{
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
Eluna::Push(L, obj->GetUInt32Value(index));
@@ -83,7 +83,7 @@ namespace LuaObject
* @param uint16 index
* @return float value
*/
int GetFloatValue(Eluna* /*E*/, lua_State* L, Object* obj)
int GetFloatValue(lua_State* L, Object* obj)
{
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
Eluna::Push(L, obj->GetFloatValue(index));
@@ -99,7 +99,7 @@ namespace LuaObject
* @param uint8 offset : should be 0, 1, 2, or 3
* @return uint8 value
*/
int GetByteValue(Eluna* /*E*/, lua_State* L, Object* obj)
int GetByteValue(lua_State* L, Object* obj)
{
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
uint8 offset = Eluna::CHECKVAL<uint8>(L, 3);
@@ -116,7 +116,7 @@ namespace LuaObject
* @param uint8 offset : should be 0 or 1
* @return uint16 value
*/
int GetUInt16Value(Eluna* /*E*/, lua_State* L, Object* obj)
int GetUInt16Value(lua_State* L, Object* obj)
{
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
uint8 offset = Eluna::CHECKVAL<uint8>(L, 3);
@@ -131,7 +131,7 @@ namespace LuaObject
*
* @return float scale
*/
int GetScale(Eluna* /*E*/, lua_State* L, Object* obj)
int GetScale(lua_State* L, Object* obj)
{
Eluna::Push(L, obj->GetObjectScale());
return 1;
@@ -144,7 +144,7 @@ namespace LuaObject
*
* @return uint32 entry
*/
int GetEntry(Eluna* /*E*/, lua_State* L, Object* obj)
int GetEntry(lua_State* L, Object* obj)
{
Eluna::Push(L, obj->GetEntry());
return 1;
@@ -162,7 +162,7 @@ namespace LuaObject
*
* @return uint64 guid
*/
int GetGUID(Eluna* /*E*/, lua_State* L, Object* obj)
int GetGUID(lua_State* L, Object* obj)
{
Eluna::Push(L, obj->GET_GUID());
return 1;
@@ -180,7 +180,7 @@ namespace LuaObject
*
* @return uint32 guidLow
*/
int GetGUIDLow(Eluna* /*E*/, lua_State* L, Object* obj)
int GetGUIDLow(lua_State* L, Object* obj)
{
#ifdef TRINITY
Eluna::Push(L, obj->GetGUID().GetCounter());
@@ -207,7 +207,7 @@ namespace LuaObject
*
* @return uint8 typeID
*/
int GetTypeId(Eluna* /*E*/, lua_State* L, Object* obj)
int GetTypeId(lua_State* L, Object* obj)
{
Eluna::Push(L, obj->GetTypeId());
return 1;
@@ -219,7 +219,7 @@ namespace LuaObject
* @param uint16 index
* @return uint64 value
*/
int GetUInt64Value(Eluna* /*E*/, lua_State* L, Object* obj)
int GetUInt64Value(lua_State* L, Object* obj)
{
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
obj->GetUInt64Value(index);
@@ -236,7 +236,7 @@ namespace LuaObject
* @param uint16 index
* @param uint32 value
*/
int SetFlag(Eluna* /*E*/, lua_State* L, Object* obj)
int SetFlag(lua_State* L, Object* obj)
{
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
uint32 flag = Eluna::CHECKVAL<uint32>(L, 3);
@@ -251,7 +251,7 @@ namespace LuaObject
* @param uint16 index
* @param int32 value
*/
int SetInt32Value(Eluna* /*E*/, lua_State* L, Object* obj)
int SetInt32Value(lua_State* L, Object* obj)
{
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
int32 value = Eluna::CHECKVAL<int32>(L, 3);
@@ -265,7 +265,7 @@ namespace LuaObject
* @param uint16 index
* @param uint32 value
*/
int SetUInt32Value(Eluna* /*E*/, lua_State* L, Object* obj)
int SetUInt32Value(lua_State* L, Object* obj)
{
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
uint32 value = Eluna::CHECKVAL<uint32>(L, 3);
@@ -279,7 +279,7 @@ namespace LuaObject
* @param uint16 index
* @param uint32 value
*/
int UpdateUInt32Value(Eluna* /*E*/, lua_State* L, Object* obj)
int UpdateUInt32Value(lua_State* L, Object* obj)
{
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
uint32 value = Eluna::CHECKVAL<uint32>(L, 3);
@@ -293,7 +293,7 @@ namespace LuaObject
* @param uint16 index
* @param float value
*/
int SetFloatValue(Eluna* /*E*/, lua_State* L, Object* obj)
int SetFloatValue(lua_State* L, Object* obj)
{
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
float value = Eluna::CHECKVAL<float>(L, 3);
@@ -309,7 +309,7 @@ namespace LuaObject
* @param uint8 offset : should be 0, 1, 2, or 3
* @param uint8 value
*/
int SetByteValue(Eluna* /*E*/, lua_State* L, Object* obj)
int SetByteValue(lua_State* L, Object* obj)
{
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
uint8 offset = Eluna::CHECKVAL<uint8>(L, 3);
@@ -325,7 +325,7 @@ namespace LuaObject
* @param uint8 offset : should be 0 or 1
* @param uint16 value
*/
int SetUInt16Value(Eluna* /*E*/, lua_State* L, Object* obj)
int SetUInt16Value(lua_State* L, Object* obj)
{
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
uint8 offset = Eluna::CHECKVAL<uint8>(L, 3);
@@ -341,7 +341,7 @@ namespace LuaObject
* @param uint8 offset : should be 0 or 1
* @param int16 value
*/
int SetInt16Value(Eluna* /*E*/, lua_State* L, Object* obj)
int SetInt16Value(lua_State* L, Object* obj)
{
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
uint8 offset = Eluna::CHECKVAL<uint8>(L, 3);
@@ -355,7 +355,7 @@ namespace LuaObject
*
* @param float scale
*/
int SetScale(Eluna* /*E*/, lua_State* L, Object* obj)
int SetScale(lua_State* L, Object* obj)
{
float size = Eluna::CHECKVAL<float>(L, 2);
@@ -369,7 +369,7 @@ namespace LuaObject
* @param uint16 index
* @param uint64 value
*/
int SetUInt64Value(Eluna* /*E*/, lua_State* L, Object* obj)
int SetUInt64Value(lua_State* L, Object* obj)
{
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
uint64 value = Eluna::CHECKVAL<uint64>(L, 3);
@@ -383,7 +383,7 @@ namespace LuaObject
* @param uint16 index
* @param uint32 flag
*/
int RemoveFlag(Eluna* /*E*/, lua_State* L, Object* obj)
int RemoveFlag(lua_State* L, Object* obj)
{
uint16 index = Eluna::CHECKVAL<uint16>(L, 2);
uint32 flag = Eluna::CHECKVAL<uint32>(L, 3);
@@ -399,7 +399,7 @@ namespace LuaObject
*
* @return [Corpse] corpse : the [Object] as a [Corpse], or `nil`
*/
int ToCorpse(Eluna* /*E*/, lua_State* L, Object* obj)
int ToCorpse(lua_State* L, Object* obj)
{
Eluna::Push(L, obj->ToCorpse());
return 1;
@@ -412,7 +412,7 @@ namespace LuaObject
*
* @return [GameObject] gameObject : the [Object] as a [GameObject], or `nil`
*/
int ToGameObject(Eluna* /*E*/, lua_State* L, Object* obj)
int ToGameObject(lua_State* L, Object* obj)
{
Eluna::Push(L, obj->ToGameObject());
return 1;
@@ -425,7 +425,7 @@ namespace LuaObject
*
* @return [Unit] unit : the [Object] as a [Unit], or `nil`
*/
int ToUnit(Eluna* /*E*/, lua_State* L, Object* obj)
int ToUnit(lua_State* L, Object* obj)
{
Eluna::Push(L, obj->ToUnit());
return 1;
@@ -438,7 +438,7 @@ namespace LuaObject
*
* @return [Creature] creature : the [Object] as a [Creature], or `nil`
*/
int ToCreature(Eluna* /*E*/, lua_State* L, Object* obj)
int ToCreature(lua_State* L, Object* obj)
{
Eluna::Push(L, obj->ToCreature());
return 1;
@@ -451,7 +451,7 @@ namespace LuaObject
*
* @return [Player] player : the [Object] as a [Player], or `nil`
*/
int ToPlayer(Eluna* /*E*/, lua_State* L, Object* obj)
int ToPlayer(lua_State* L, Object* obj)
{
Eluna::Push(L, obj->ToPlayer());
return 1;