Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/orxonox/core/Script.h @ 1046

Last change on this file since 1046 was 1038, checked in by landauf, 16 years ago

compiles on tardis

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
10extern "C" {
11#include "lua.h"
12}
13
14#include <list>
15#include <string>
16
17namespace orxonox // tolua_export
18{ // tolua_export
19
20  class Script // tolua_export
21  { // tolua_export
22    public:
23      inline static Script* getInstance() { if (!Script::singletonRef) Script::singletonRef = new Script(); return Script::singletonRef; } // tolua_export
24      inline ~Script() { Script::singletonRef = NULL; };
25
26    void loadFile(std::string filename, bool luaTags);
27    //void init(lua_State *state_);
28    //void xmlToLua();
29    void run();
30    void luaPrint(std::string str); // tolua_export
31
32#if LUA_VERSION_NUM != 501
33    inline static const char * lua_Chunkreader(lua_State *L, void *data, size_t *size) { return NULL;};
34#endif
35
36    inline lua_State* getLuaState() { return luaState_; };
37    inline std::string getLuaOutput() { return output_; };
38    //inline std::string* getFileString() { return &fileString_; };
39
40    unsigned int getNextQuote(const std::string& text, unsigned int start);
41    std::string replaceLuaTags(const std::string& text);
42
43    private:
44      Script();
45      static Script* singletonRef;
46
47      std::string luaSource_;
48      std::string output_;
49      lua_State* luaState_;
50
51  }; // tolua_export
52} // tolua_export
53#endif /* _Script_H__ */
Note: See TracBrowser for help on using the repository browser.