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

@@ -25,7 +25,7 @@ namespace LuaPacket
*
* @return uint16 opcode
*/
int GetOpcode(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int GetOpcode(lua_State* L, WorldPacket* packet)
{
Eluna::Push(L, packet->GetOpcode());
return 1;
@@ -36,7 +36,7 @@ namespace LuaPacket
*
* @return uint32 size
*/
int GetSize(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int GetSize(lua_State* L, WorldPacket* packet)
{
Eluna::Push(L, packet->size());
return 1;
@@ -47,7 +47,7 @@ namespace LuaPacket
*
* @param [Opcodes] opcode : see Opcodes.h for all known opcodes
*/
int SetOpcode(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int SetOpcode(lua_State* L, WorldPacket* packet)
{
uint32 opcode = Eluna::CHECKVAL<uint32>(L, 2);
if (opcode >= NUM_MSG_TYPES)
@@ -61,7 +61,7 @@ namespace LuaPacket
*
* @return int8 value
*/
int ReadByte(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int ReadByte(lua_State* L, WorldPacket* packet)
{
int8 _byte;
(*packet) >> _byte;
@@ -74,7 +74,7 @@ namespace LuaPacket
*
* @return uint8 value
*/
int ReadUByte(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int ReadUByte(lua_State* L, WorldPacket* packet)
{
uint8 _ubyte;
(*packet) >> _ubyte;
@@ -87,7 +87,7 @@ namespace LuaPacket
*
* @return int16 value
*/
int ReadShort(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int ReadShort(lua_State* L, WorldPacket* packet)
{
int16 _short;
(*packet) >> _short;
@@ -100,7 +100,7 @@ namespace LuaPacket
*
* @return uint16 value
*/
int ReadUShort(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int ReadUShort(lua_State* L, WorldPacket* packet)
{
uint16 _ushort;
(*packet) >> _ushort;
@@ -113,7 +113,7 @@ namespace LuaPacket
*
* @return int32 value
*/
int ReadLong(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int ReadLong(lua_State* L, WorldPacket* packet)
{
int32 _long;
(*packet) >> _long;
@@ -126,7 +126,7 @@ namespace LuaPacket
*
* @return uint32 value
*/
int ReadULong(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int ReadULong(lua_State* L, WorldPacket* packet)
{
uint32 _ulong;
(*packet) >> _ulong;
@@ -139,7 +139,7 @@ namespace LuaPacket
*
* @return float value
*/
int ReadFloat(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int ReadFloat(lua_State* L, WorldPacket* packet)
{
float _val;
(*packet) >> _val;
@@ -152,7 +152,7 @@ namespace LuaPacket
*
* @return double value
*/
int ReadDouble(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int ReadDouble(lua_State* L, WorldPacket* packet)
{
double _val;
(*packet) >> _val;
@@ -165,7 +165,7 @@ namespace LuaPacket
*
* @return uint64 value : value returned as string
*/
int ReadGUID(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int ReadGUID(lua_State* L, WorldPacket* packet)
{
uint64 guid;
(*packet) >> guid;
@@ -178,7 +178,7 @@ namespace LuaPacket
*
* @return string value
*/
int ReadString(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int ReadString(lua_State* L, WorldPacket* packet)
{
std::string _val;
(*packet) >> _val;
@@ -191,7 +191,7 @@ namespace LuaPacket
*
* @param uint64 value : the value to be written to the [WorldPacket]
*/
int WriteGUID(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int WriteGUID(lua_State* L, WorldPacket* packet)
{
uint64 guid = Eluna::CHECKVAL<uint64>(L, 2);
(*packet) << guid;
@@ -203,7 +203,7 @@ namespace LuaPacket
*
* @param string value : the string to be written to the [WorldPacket]
*/
int WriteString(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int WriteString(lua_State* L, WorldPacket* packet)
{
std::string _val = Eluna::CHECKVAL<std::string>(L, 2);
(*packet) << _val;
@@ -215,7 +215,7 @@ namespace LuaPacket
*
* @param int8 value : the int8 value to be written to the [WorldPacket]
*/
int WriteByte(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int WriteByte(lua_State* L, WorldPacket* packet)
{
int8 byte = Eluna::CHECKVAL<int8>(L, 2);
(*packet) << byte;
@@ -227,7 +227,7 @@ namespace LuaPacket
*
* @param uint8 value : the uint8 value to be written to the [WorldPacket]
*/
int WriteUByte(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int WriteUByte(lua_State* L, WorldPacket* packet)
{
uint8 byte = Eluna::CHECKVAL<uint8>(L, 2);
(*packet) << byte;
@@ -239,7 +239,7 @@ namespace LuaPacket
*
* @param int16 value : the int16 value to be written to the [WorldPacket]
*/
int WriteShort(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int WriteShort(lua_State* L, WorldPacket* packet)
{
int16 _short = Eluna::CHECKVAL<int16>(L, 2);
(*packet) << _short;
@@ -251,7 +251,7 @@ namespace LuaPacket
*
* @param uint16 value : the uint16 value to be written to the [WorldPacket]
*/
int WriteUShort(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int WriteUShort(lua_State* L, WorldPacket* packet)
{
uint16 _ushort = Eluna::CHECKVAL<uint16>(L, 2);
(*packet) << _ushort;
@@ -263,7 +263,7 @@ namespace LuaPacket
*
* @param int32 value : the int32 value to be written to the [WorldPacket]
*/
int WriteLong(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int WriteLong(lua_State* L, WorldPacket* packet)
{
int32 _long = Eluna::CHECKVAL<int32>(L, 2);
(*packet) << _long;
@@ -275,7 +275,7 @@ namespace LuaPacket
*
* @param uint32 value : the uint32 value to be written to the [WorldPacket]
*/
int WriteULong(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int WriteULong(lua_State* L, WorldPacket* packet)
{
uint32 _ulong = Eluna::CHECKVAL<uint32>(L, 2);
(*packet) << _ulong;
@@ -287,7 +287,7 @@ namespace LuaPacket
*
* @param float value : the float value to be written to the [WorldPacket]
*/
int WriteFloat(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int WriteFloat(lua_State* L, WorldPacket* packet)
{
float _val = Eluna::CHECKVAL<float>(L, 2);
(*packet) << _val;
@@ -299,7 +299,7 @@ namespace LuaPacket
*
* @param double value : the double value to be written to the [WorldPacket]
*/
int WriteDouble(Eluna* /*E*/, lua_State* L, WorldPacket* packet)
int WriteDouble(lua_State* L, WorldPacket* packet)
{
double _val = Eluna::CHECKVAL<double>(L, 2);
(*packet) << _val;