Last change
on this file since 1048 was
1048,
checked in by rgrieder, 16 years ago
|
- final commit for tolua++ displacement
|
File size:
1.4 KB
|
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 | |
---|
[1048] | 10 | #include "CorePrereqs.h" |
---|
| 11 | |
---|
[954] | 12 | extern "C" { |
---|
[1048] | 13 | #include <lua.h> |
---|
[954] | 14 | } |
---|
[946] | 15 | |
---|
[956] | 16 | #include <list> |
---|
| 17 | #include <string> |
---|
| 18 | |
---|
[996] | 19 | namespace orxonox // tolua_export |
---|
| 20 | { // tolua_export |
---|
[946] | 21 | |
---|
[1048] | 22 | class _CoreExport Script // tolua_export |
---|
[996] | 23 | { // tolua_export |
---|
| 24 | public: |
---|
[1019] | 25 | inline static Script* getInstance() { if (!Script::singletonRef) Script::singletonRef = new Script(); return Script::singletonRef; } // tolua_export |
---|
[999] | 26 | inline ~Script() { Script::singletonRef = NULL; }; |
---|
[946] | 27 | |
---|
[999] | 28 | void loadFile(std::string filename, bool luaTags); |
---|
| 29 | //void init(lua_State *state_); |
---|
[996] | 30 | //void xmlToLua(); |
---|
[999] | 31 | void run(); |
---|
[996] | 32 | void luaPrint(std::string str); // tolua_export |
---|
[956] | 33 | |
---|
[1029] | 34 | #if LUA_VERSION_NUM != 501 |
---|
[1038] | 35 | inline static const char * lua_Chunkreader(lua_State *L, void *data, size_t *size) { return NULL;}; |
---|
[1029] | 36 | #endif |
---|
| 37 | |
---|
[999] | 38 | inline lua_State* getLuaState() { return luaState_; }; |
---|
| 39 | inline std::string getLuaOutput() { return output_; }; |
---|
| 40 | //inline std::string* getFileString() { return &fileString_; }; |
---|
[946] | 41 | |
---|
[999] | 42 | unsigned int getNextQuote(const std::string& text, unsigned int start); |
---|
| 43 | std::string replaceLuaTags(const std::string& text); |
---|
[996] | 44 | |
---|
[946] | 45 | private: |
---|
[999] | 46 | Script(); |
---|
| 47 | static Script* singletonRef; |
---|
[956] | 48 | |
---|
[999] | 49 | std::string luaSource_; |
---|
| 50 | std::string output_; |
---|
| 51 | lua_State* luaState_; |
---|
[956] | 52 | |
---|
[996] | 53 | }; // tolua_export |
---|
| 54 | } // tolua_export |
---|
[946] | 55 | #endif /* _Script_H__ */ |
---|
Note: See
TracBrowser
for help on using the repository browser.