From 47a497fa895fa5f353ba593d4bb232ea514e66c9 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 9 Feb 2014 20:39:45 +0100 Subject: First working version of cLuaChunkStay. It works, but has random failures, probably due to threading issues. --- src/Bindings/LuaChunkStay.h | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'src/Bindings/LuaChunkStay.h') diff --git a/src/Bindings/LuaChunkStay.h b/src/Bindings/LuaChunkStay.h index e9d87d7f6..0ab73f669 100644 --- a/src/Bindings/LuaChunkStay.h +++ b/src/Bindings/LuaChunkStay.h @@ -24,23 +24,28 @@ class cLuaChunkStay public: // Allow Lua to construct objects of this class: - cLuaChunkStay(void) {} + cLuaChunkStay(void); // Allow Lua to garbage-collect objects of this class: - ~cLuaChunkStay() {} + ~cLuaChunkStay() { } // tolua_end - /** Enabled the ChunkStay for the specified world, with the specified Lua callbacks. + /** Enables the ChunkStay for the specified world, with the specified Lua callbacks. Exported in ManualBindings. */ void Enable( - cWorld & a_World, cLuaState & a_LuaState, - const cLuaState::cRef & a_OnChunkAvailable, const cLuaState::cRef & a_OnAllChunksAvailable + cWorld & a_World, lua_State * a_LuaState, + int a_OnChunkAvailableStackPos, int a_OnAllChunksAvailableStackPos ); + // tolua_begin + + /** Disables the ChunkStay. Cleans up the bound Lua state and callbacks */ + virtual void Disable(void); + protected: /** The Lua state associated with the callbacks. Only valid when enabled. */ - cLuaState * m_LuaState; + cLuaState m_LuaState; /** The Lua function to call in OnChunkAvailable. Only valid when enabled. */ cLuaState::cRef m_OnChunkAvailable; @@ -51,7 +56,9 @@ protected: // cChunkStay overrides: virtual void OnChunkAvailable(int a_ChunkX, int a_ChunkZ) override; virtual void OnAllChunksAvailable(void) override; -} ; // tolua_export +} ; + +// tolua_end -- cgit v1.2.3