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