some network refactoring

This commit is contained in:
Eduardo Bart 2011-07-27 20:01:33 -03:00
parent a62785911a
commit ea2645c151
15 changed files with 76 additions and 348 deletions

View File

@ -1,30 +1,8 @@
/* The MIT License
*
* Copyright (c) 2010 OTClient, https://github.com/edubart/otclient
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "connection.h"
#include <core/dispatcher.h>
#include <net/connection.h>
static boost::asio::io_service ioService;
static asio::io_service ioService;
Connection::Connection() :
m_timer(ioService),
@ -39,11 +17,11 @@ void Connection::poll()
ioService.reset();
}
void Connection::connect(const std::string& host, uint16 port, const std::function<void()>& connectCallback)
void Connection::connect(const std::string& host, uint16 port, const ConnectCallback& connectCallback)
{
m_connectCallback = connectCallback;
boost::asio::ip::tcp::resolver::query query(host, convert<std::string>(port));
asio::ip::tcp::resolver::query query(host, convert<std::string>(port));
m_resolver.async_resolve(query, std::bind(&Connection::onResolve, shared_from_this(), std::placeholders::_1, std::placeholders::_2));
m_timer.expires_from_now(boost::posix_time::seconds(2));
@ -52,8 +30,8 @@ void Connection::connect(const std::string& host, uint16 port, const std::functi
void Connection::send(uint8* buffer, uint16 size)
{
boost::asio::async_write(m_socket,
boost::asio::buffer(buffer, size),
asio::async_write(m_socket,
asio::buffer(buffer, size),
std::bind(&Connection::onSend, shared_from_this(), std::placeholders::_1, std::placeholders::_2));
m_timer.expires_from_now(boost::posix_time::seconds(2));
@ -65,8 +43,8 @@ void Connection::recv(uint16 bytes, uint32 timeout, const RecvCallback& callback
m_recvCallback = callback;
m_recvSize = bytes;
boost::asio::async_read(m_socket,
boost::asio::buffer(m_recvBuffer, bytes),
asio::async_read(m_socket,
asio::buffer(m_recvBuffer, bytes),
std::bind(&Connection::onRecv, shared_from_this(), std::placeholders::_1));
if(timeout > 0) {
@ -77,11 +55,11 @@ void Connection::recv(uint16 bytes, uint32 timeout, const RecvCallback& callback
void Connection::onTimeout(const boost::system::error_code& error)
{
if(error != boost::asio::error::operation_aborted)
if(error != asio::error::operation_aborted)
g_dispatcher.addTask(std::bind(m_errorCallback, error));
}
void Connection::onResolve(const boost::system::error_code& error, boost::asio::ip::tcp::resolver::iterator endpointIterator)
void Connection::onResolve(const boost::system::error_code& error, asio::ip::tcp::resolver::iterator endpointIterator)
{
m_timer.cancel();

View File

@ -1,69 +1,44 @@
/* The MIT License
*
* Copyright (c) 2010 OTClient, https://github.com/edubart/otclient
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef CONNECTION_H
#define CONNECTION_H
#include <global.h>
#include <boost/asio.hpp>
typedef std::function<void(boost::system::error_code&)> ErrorCallback;
typedef std::function<void(uint8*, uint16)> RecvCallback;
#include "netdeclarations.h"
class Connection : public std::enable_shared_from_this<Connection>, boost::noncopyable
{
typedef std::function<void(boost::system::error_code&)> ErrorCallback;
typedef std::function<void(uint8*, uint16)> RecvCallback;
typedef std::function<void()> ConnectCallback;
public:
Connection();
static void poll();
void connect(const std::string& host, uint16 port, const std::function<void()>& connectCallback);
void connect(const std::string& host, uint16 port, const ConnectCallback& connectCallback);
void send(uint8* buffer, uint16 size);
void recv(uint16 bytes, uint32 timeout, const RecvCallback& callback);
void setErrorCallback(const ErrorCallback& errorCallback) { m_errorCallback = errorCallback; }
void setRecvCallback(const RecvCallback& recvCallback) { m_recvCallback = recvCallback; }
private:
void onTimeout(const boost::system::error_code& error);
void onResolve(const boost::system::error_code& error, boost::asio::ip::tcp::resolver::iterator endpointIterator);
void onResolve(const boost::system::error_code& error, asio::ip::tcp::resolver::iterator endpointIterator);
void onConnect(const boost::system::error_code& error);
void onSend(const boost::system::error_code& error, size_t);
void onRecv(const boost::system::error_code& error);
private:
ErrorCallback m_errorCallback;
std::function<void()> m_connectCallback;
boost::asio::deadline_timer m_timer;
boost::asio::ip::tcp::resolver m_resolver;
boost::asio::ip::tcp::socket m_socket;
ErrorCallback m_errorCallback;
ConnectCallback m_connectCallback;
asio::deadline_timer m_timer;
asio::ip::tcp::resolver m_resolver;
asio::ip::tcp::socket m_socket;
uint8 m_recvBuffer[65536];
uint16 m_recvSize;
RecvCallback m_recvCallback;
};
typedef std::shared_ptr<Connection> ConnectionPtr;
#endif

View File

@ -1,28 +1,4 @@
/* The MIT License
*
* Copyright (c) 2010 OTClient, https://github.com/edubart/otclient
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <net/inputmessage.h>
#include "inputmessage.h"
InputMessage::InputMessage()
{
@ -37,17 +13,13 @@ void InputMessage::reset()
uint8 InputMessage::getU8()
{
if(!canRead(1))
return 0;
assert(canRead(1));
return m_buffer[m_readPos++];
}
uint16 InputMessage::getU16()
{
if(!canRead(2))
return 0;
assert(canRead(2));
uint16 v = *(uint16_t*)(m_buffer + m_readPos);
m_readPos += 2;
return v;
@ -55,9 +27,7 @@ uint16 InputMessage::getU16()
uint32 InputMessage::getU32()
{
if(!canRead(4))
return 0;
assert(canRead(4));
uint32 v = *(uint32*)(m_buffer + m_readPos);
m_readPos += 4;
return v;
@ -65,9 +35,7 @@ uint32 InputMessage::getU32()
uint64 InputMessage::getU64()
{
if(!canRead(8))
return 0;
assert(canRead(8));
uint64 v = *(uint64*)(m_buffer + m_readPos);
m_readPos += 8;
return v;
@ -76,9 +44,7 @@ uint64 InputMessage::getU64()
std::string InputMessage::getString()
{
uint16 stringLength = getU16();
if(!canRead(stringLength))
return std::string();
assert(canRead(stringLength));
char* v = (char*)(m_buffer + m_readPos);
m_readPos += stringLength;
return std::string(v, stringLength);
@ -87,6 +53,6 @@ std::string InputMessage::getString()
bool InputMessage::canRead(int bytes)
{
if((m_readPos + bytes > m_messageSize) || (m_readPos + bytes > BUFFER_MAXSIZE))
logFatal("[InputMessage::canRead()]: Cant read. Message is finished or read position has reached buffer's maximum size.");
return false;
return true;
}

View File

@ -1,31 +1,7 @@
/* The MIT License
*
* Copyright (c) 2010 OTClient, https://github.com/edubart/otclient
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef INPUTMESSAGE_H
#define INPUTMESSAGE_H
#include <global.h>
#include "netdeclarations.h"
class InputMessage
{

View File

@ -1,27 +1,3 @@
/* The MIT License
*
* Copyright (c) 2010 OTClient, https://github.com/edubart/otclient
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <net/outputmessage.h>
OutputMessage::OutputMessage()
@ -37,9 +13,7 @@ void OutputMessage::reset()
void OutputMessage::addU8(uint8 value)
{
if(!canWrite(1))
return;
assert(canWrite(1));
m_buffer[m_writePos] = value;
m_writePos += 1;
m_messageSize += 1;
@ -47,9 +21,7 @@ void OutputMessage::addU8(uint8 value)
void OutputMessage::addU16(uint16 value)
{
if(!canWrite(2))
return;
assert(canWrite(2));
*(uint16_t*)(m_buffer + m_writePos) = value;
m_writePos += 2;
m_messageSize += 2;
@ -57,9 +29,7 @@ void OutputMessage::addU16(uint16 value)
void OutputMessage::addU32(uint32 value)
{
if(!canWrite(4))
return;
assert(canWrite(4));
*(uint32*)(m_buffer + m_writePos) = value;
m_writePos += 4;
m_messageSize += 4;
@ -67,9 +37,7 @@ void OutputMessage::addU32(uint32 value)
void OutputMessage::addU64(uint64 value)
{
if(!canWrite(8))
return;
assert(canWrite(8));
*(uint64*)(m_buffer + m_writePos) = value;
m_writePos += 8;
m_messageSize += 8;
@ -78,9 +46,7 @@ void OutputMessage::addU64(uint64 value)
void OutputMessage::addString(const char* value)
{
size_t stringLength = strlen(value);
if(stringLength > 0xFFFF || !canWrite(stringLength + 2))
return;
assert(stringLength < 0xFFFF && canWrite(stringLength + 2));
addU16(stringLength);
strcpy((char*)(m_buffer + m_writePos), value);
m_writePos += stringLength;
@ -94,9 +60,7 @@ void OutputMessage::addString(const std::string &value)
void OutputMessage::addPaddingBytes(int bytes, uint8 byte)
{
if(!canWrite(bytes))
return;
assert(canWrite(bytes) && bytes >= 0);
memset((void*)&m_buffer[m_writePos], byte, bytes);
m_writePos += bytes;
m_messageSize += bytes;
@ -105,6 +69,6 @@ void OutputMessage::addPaddingBytes(int bytes, uint8 byte)
bool OutputMessage::canWrite(int bytes)
{
if(m_writePos + bytes > BUFFER_MAXSIZE)
logFatal("[OutputMessage::canWrite()]: Can't write. Write position has reached buffer's maxium size.");
return false;
return true;
}

View File

@ -1,31 +1,7 @@
/* The MIT License
*
* Copyright (c) 2010 OTClient, https://github.com/edubart/otclient
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef OUTPUTMESSAGE_H
#define OUTPUTMESSAGE_H
#include <global.h>
#include "netdeclarations.h"
class OutputMessage
{

View File

@ -1,30 +1,5 @@
/* The MIT License
*
* Copyright (c) 2010 OTClient, https://github.com/edubart/otclient
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <net/protocol.h>
#include <boost/bind.hpp>
#include "protocol.h"
#include "connection.h"
Protocol::Protocol() :
m_connection(new Connection)

View File

@ -1,46 +1,12 @@
/* The MIT License
*
* Copyright (c) 2010 OTClient, https://github.com/edubart/otclient
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef PROTOCOL_H
#define PROTOCOL_H
#include <net/connection.h>
#include <net/inputmessage.h>
#include <net/outputmessage.h>
#include "netdeclarations.h"
#include "inputmessage.h"
#include "outputmessage.h"
#include <script/luaobject.h>
#define CIPSOFT_PUBLIC_RSA "1321277432058722840622950990822933849527763264961655079678763618" \
"4334395343554449668205332383339435179772895415509701210392836078" \
"6959821132214473291575712138800495033169914814069637740318278150" \
"2907336840325241747827401343576296990629870233111328210165697754" \
"88792221429527047321331896351555606801473202394175817"
//#define RSA "109120132967399429278860960508995541528237502902798129123468757937266291492576446330739696001110603907230888610072655818825358503429057592827629436413108566029093628212635953836686562675849720620786279431090218017681061521755056710823876476444260558147179707119674283982419152118103759076030616683978566631413"
class Protocol;
typedef std::shared_ptr<Protocol> ProtocolPtr;
class Protocol : public LuaObject
{
public:

View File

@ -1,27 +1,3 @@
/* The MIT License
*
* Copyright (c) 2010 OTClient, https://github.com/edubart/otclient
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <global.h>
#include "rsa.h"
Rsa::Rsa()

View File

@ -1,31 +1,7 @@
/* The MIT License
*
* Copyright (c) 2010 OTClient, https://github.com/edubart/otclient
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef RSA_H
#define RSA_H
#include <global.h>
#include <gmp.h>
class Rsa

View File

@ -194,7 +194,7 @@ void LuaState::pushValue(const LuaValuePtr& value)
if(value->isNil())
pushNil();
else
pushRef(value->ref);
pushRef(value->m_ref);
}
void LuaState::pushValues(const LuaValueList& values)

View File

@ -4,14 +4,14 @@
#include <core/resources.h>
LuaValue::LuaValue(int ref) : ref(ref)
LuaValue::LuaValue(int ref) : m_ref(ref)
{
}
LuaValue::~LuaValue()
{
// releases the reference of this value from lua
g_lua.unref(ref);
g_lua.unref(m_ref);
}
LuaValueList LuaValue::call(const std::string& funcName, const LuaValueList& args)

View File

@ -49,7 +49,7 @@ public:
std::string getTypeName();
// check types
bool isNil() { return ref < 0; }
bool isNil() { return m_ref < 0; }
bool isBoolean();
bool isString();
bool isNumber();
@ -70,7 +70,7 @@ private:
/// Pushes this value into lua stack
void push();
int ref;
int m_ref;
friend class LuaState;
};