Rev | Line | |
---|
[946] | 1 | /** |
---|
| 2 | @file script.h |
---|
[996] | 3 | @brief Representation of an interface to lua |
---|
[946] | 4 | @author Benjamin Knecht <beni_at_orxonox.net> |
---|
| 5 | */ |
---|
| 6 | |
---|
| 7 | #ifndef _Script_H__ |
---|
| 8 | #define _Script_H__ |
---|
| 9 | |
---|
[954] | 10 | extern "C" { |
---|
| 11 | #include "lua.h" |
---|
| 12 | } |
---|
[946] | 13 | |
---|
[956] | 14 | #include <list> |
---|
| 15 | #include <string> |
---|
| 16 | |
---|
[996] | 17 | namespace orxonox // tolua_export |
---|
| 18 | { // tolua_export |
---|
[946] | 19 | |
---|
[996] | 20 | class Script // tolua_export |
---|
| 21 | { // tolua_export |
---|
| 22 | public: |
---|
[1019] | 23 | inline static Script* getInstance() { if (!Script::singletonRef) Script::singletonRef = new Script(); return Script::singletonRef; } // tolua_export |
---|
[999] | 24 | inline ~Script() { Script::singletonRef = NULL; }; |
---|
[946] | 25 | |
---|
[999] | 26 | void loadFile(std::string filename, bool luaTags); |
---|
| 27 | //void init(lua_State *state_); |
---|
[996] | 28 | //void xmlToLua(); |
---|
[999] | 29 | void run(); |
---|
[996] | 30 | void luaPrint(std::string str); // tolua_export |
---|
[956] | 31 | |
---|
[1029] | 32 | #if LUA_VERSION_NUM != 501 |
---|
| 33 | inline const char * lua_Chunkreader(lua_State *L, void *data, size_t *size) { return NULL;}; |
---|
| 34 | #endif |
---|
| 35 | |
---|
[999] | 36 | inline lua_State* getLuaState() { return luaState_; }; |
---|
| 37 | inline std::string getLuaOutput() { return output_; }; |
---|
| 38 | //inline std::string* getFileString() { return &fileString_; }; |
---|
[946] | 39 | |
---|
[999] | 40 | unsigned int getNextQuote(const std::string& text, unsigned int start); |
---|
| 41 | std::string replaceLuaTags(const std::string& text); |
---|
[996] | 42 | |
---|
[946] | 43 | private: |
---|
[999] | 44 | Script(); |
---|
| 45 | static Script* singletonRef; |
---|
[956] | 46 | |
---|
[999] | 47 | std::string luaSource_; |
---|
| 48 | std::string output_; |
---|
| 49 | lua_State* luaState_; |
---|
[956] | 50 | |
---|
[996] | 51 | }; // tolua_export |
---|
| 52 | } // tolua_export |
---|
[946] | 53 | #endif /* _Script_H__ */ |
---|
Note: See
TracBrowser
for help on using the repository browser.