MCPcopy Create free account
hub / github.com/SOUI2/soui / LuaFunctionSlot

Class LuaFunctionSlot

components/ScriptModule-LUA/src/ScriptModule-Lua.cpp:46–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44 }
45
46 class LuaFunctionSlot : public ISlotFunctor
47 {
48 public:
49 //! Slot function type.
50 LuaFunctionSlot(lua_State *pLuaState,LPCSTR pszLuaFun)
51 : m_pLuaState(pLuaState)
52 , m_luaFun(pszLuaFun)
53 {}
54
55 virtual bool operator()(EventArgs *pArg)
56 {
57 return lua_tinker::call<bool>(m_pLuaState,m_luaFun,pArg);
58 }
59
60 virtual ISlotFunctor* Clone() const
61 {
62 return new LuaFunctionSlot(m_pLuaState,m_luaFun);
63 }
64
65 virtual bool Equal(const ISlotFunctor & sour)const
66 {
67 if(sour.GetSlotType()!=GetSlotType()) return false;
68 const LuaFunctionSlot *psour=static_cast<const LuaFunctionSlot*>(&sour);
69 SASSERT(psour);
70 return psour->m_luaFun==m_luaFun && psour->m_pLuaState==m_pLuaState;
71 }
72
73 virtual UINT GetSlotType() const {return SLOT_USER+1;}
74
75 private:
76 SStringA m_luaFun;
77 lua_State *m_pLuaState;
78 };
79
80
81 SScriptModule_Lua::SScriptModule_Lua()

Callers 2

subscribeEventMethod · 0.85
unsubscribeEventMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected