00001 #ifndef HEADER_SCRIPTAGENT_H 00002 #define HEADER_SCRIPTAGENT_H 00003 00004 class Path; 00005 class ScriptState; 00006 00007 #include "BaseAgent.h" 00008 #include "Name.h" 00009 00010 #include <string> 00011 00012 extern "C" { 00013 #include "lua.h" 00014 } 00015 00016 /** 00017 * Global scripting. 00018 * It is used by OptionAgent and debug console. 00019 */ 00020 class ScriptAgent : public BaseAgent { 00021 AGENT(ScriptAgent, Name::SCRIPT_NAME); 00022 private: 00023 ScriptState *m_state; 00024 protected: 00025 virtual void own_init(); 00026 virtual void own_shutdown(); 00027 public: 00028 void registerFunc(const char *name, lua_CFunction func); 00029 void doFile(const Path &file); 00030 00031 virtual void receiveString(const StringMsg *msg); 00032 }; 00033 00034 #endif