summaryrefslogtreecommitdiffstats
path: root/src/Bindings/LuaState.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2015-03-09 22:39:11 +0100
committerHowaner <franzi.moos@googlemail.com>2015-03-09 22:39:11 +0100
commita96c21fc0d4326ffda93cc78c5dfcfc4bd034e24 (patch)
tree38dba8f86163283d90d1d6d9d2fa420cb4e99231 /src/Bindings/LuaState.cpp
parentReadded old comment (diff)
parentFixed client kick/crash if many block changes happend (diff)
downloadcuberite-a96c21fc0d4326ffda93cc78c5dfcfc4bd034e24.tar
cuberite-a96c21fc0d4326ffda93cc78c5dfcfc4bd034e24.tar.gz
cuberite-a96c21fc0d4326ffda93cc78c5dfcfc4bd034e24.tar.bz2
cuberite-a96c21fc0d4326ffda93cc78c5dfcfc4bd034e24.tar.lz
cuberite-a96c21fc0d4326ffda93cc78c5dfcfc4bd034e24.tar.xz
cuberite-a96c21fc0d4326ffda93cc78c5dfcfc4bd034e24.tar.zst
cuberite-a96c21fc0d4326ffda93cc78c5dfcfc4bd034e24.zip
Diffstat (limited to 'src/Bindings/LuaState.cpp')
-rw-r--r--src/Bindings/LuaState.cpp69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp
index 01d3ac687..25c77a652 100644
--- a/src/Bindings/LuaState.cpp
+++ b/src/Bindings/LuaState.cpp
@@ -343,6 +343,18 @@ bool cLuaState::PushFunction(const cTableRef & a_TableRef)
+void cLuaState::PushNil(void)
+{
+ ASSERT(IsValid());
+
+ lua_pushnil(m_LuaState);
+ m_NumCurrentFunctionArgs += 1;
+}
+
+
+
+
+
void cLuaState::Push(const AString & a_String)
{
ASSERT(IsValid());
@@ -656,6 +668,42 @@ void cLuaState::Push(cItems * a_Items)
+void cLuaState::Push(cLuaServerHandle * a_ServerHandle)
+{
+ ASSERT(IsValid());
+
+ tolua_pushusertype(m_LuaState, a_ServerHandle, "cServerHandle");
+ m_NumCurrentFunctionArgs += 1;
+}
+
+
+
+
+
+void cLuaState::Push(cLuaTCPLink * a_TCPLink)
+{
+ ASSERT(IsValid());
+
+ tolua_pushusertype(m_LuaState, a_TCPLink, "cTCPLink");
+ m_NumCurrentFunctionArgs += 1;
+}
+
+
+
+
+
+void cLuaState::Push(cLuaUDPEndpoint * a_UDPEndpoint)
+{
+ ASSERT(IsValid());
+
+ tolua_pushusertype(m_LuaState, a_UDPEndpoint, "cUDPEndpoint");
+ m_NumCurrentFunctionArgs += 1;
+}
+
+
+
+
+
void cLuaState::Push(cMonster * a_Monster)
{
ASSERT(IsValid());
@@ -958,6 +1006,15 @@ void cLuaState::GetStackValue(int a_StackPos, pWorld & a_ReturnedVal)
+void cLuaState::GetStackValue(int a_StackPos, cRef & a_Ref)
+{
+ a_Ref.RefStack(*this, a_StackPos);
+}
+
+
+
+
+
bool cLuaState::CallFunction(int a_NumResults)
{
ASSERT (m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
@@ -1527,6 +1584,18 @@ cLuaState::cRef::cRef(cLuaState & a_LuaState, int a_StackPos) :
+cLuaState::cRef::cRef(cRef && a_FromRef):
+ m_LuaState(a_FromRef.m_LuaState),
+ m_Ref(a_FromRef.m_Ref)
+{
+ a_FromRef.m_LuaState = nullptr;
+ a_FromRef.m_Ref = LUA_REFNIL;
+}
+
+
+
+
+
cLuaState::cRef::~cRef()
{
if (m_LuaState != nullptr)