00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef _CEGUILuaFunctor_h_
00031 #define _CEGUILuaFunctor_h_
00032
00033 #include "../../CEGUIEventSet.h"
00034
00035 struct lua_State;
00036
00037
00038 namespace CEGUI
00039 {
00040
00041
00042 class LuaScriptModule;
00043
00048 class LuaFunctor
00049 {
00050 public:
00051 LuaFunctor(lua_State* state, int func, int selfIndex);
00052 LuaFunctor(lua_State* state, const String& func, int selfIndex);
00053
00054 LuaFunctor(lua_State* state, const int func, const int selfIndex,
00055 const String& error_handler);
00056 LuaFunctor(lua_State* state, const String& func, const int selfIndex,
00057 const String& error_handler);
00058 LuaFunctor(lua_State* state, const int func, const int selfIndex,
00059 const int error_handler);
00060 LuaFunctor(lua_State* state, const String& func, const int selfIndex,
00061 const int error_handler);
00062
00063 LuaFunctor(const LuaFunctor& cp);
00064 ~LuaFunctor();
00065
00066 bool operator()(const EventArgs& args) const;
00067
00074 static Event::Connection SubscribeEvent(EventSet* self,
00075 const String& eventName,
00076 const int funcIndex,
00077 const int selfIndex,
00078 const int error_handler,
00079 lua_State* L);
00080
00086 static void pushNamedFunction(lua_State* L, const String& name);
00087
00088 private:
00095 void invalidateLuaRefs();
00096
00097 lua_State* L;
00098 mutable int index;
00099 int self;
00100 mutable bool needs_lookup;
00101 mutable String function_name;
00102
00104 mutable String d_errFuncName;
00106 mutable int d_errFuncIndex;
00108 mutable bool d_ourErrFuncIndex;
00109
00110 friend class LuaScriptModule;
00111 };
00112
00113 }
00114
00115 #endif // end of guard _CEGUILuaFunctor_h_