Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/script/src/orxonox/core/Script.h @ 999

Last change on this file since 999 was 999, checked in by bknecht, 16 years ago

some changes with the script. Made it singleton plus the files were moved into the core.

File size: 1.2 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; }
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    inline lua_State* getLuaState() { return luaState_; };
33    inline std::string getLuaOutput() { return output_; };
34    //inline std::string* getFileString() { return &fileString_; };
35
36    unsigned int getNextQuote(const std::string& text, unsigned int start);
37    std::string replaceLuaTags(const std::string& text);
38
39    private:
40      Script();
41      static Script* singletonRef;
42
43      std::string luaSource_;
44      std::string output_;
45      lua_State* luaState_;
46
47  }; // tolua_export
48} // tolua_export
49#endif /* _Script_H__ */
Note: See TracBrowser for help on using the repository browser.