Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 6, 2008, 2:43:12 AM (17 years ago)
Author:
bknecht
Message:

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

File:
1 moved

Legend:

Unmodified
Added
Removed
  • code/branches/script/src/orxonox/core/Script.h

    r996 r999  
    2121  { // tolua_export
    2222    public:
    23     Script(); // tolua_export
    24     ~Script();
     23      inline static Script* getInstance() { if (!Script::singletonRef) Script::singletonRef = new Script(); return Script::singletonRef; }
     24      inline ~Script() { Script::singletonRef = NULL; };
    2525
    26     static void loadFile(std::string filename, bool luaTags);
    27     static void init(lua_State *state_);
     26    void loadFile(std::string filename, bool luaTags);
     27    //void init(lua_State *state_);
    2828    //void xmlToLua();
    29     static void run();
     29    void run();
    3030    void luaPrint(std::string str); // tolua_export
    3131
    32     inline static lua_State* getLuaState() { return luaState_; };
    33     inline static std::string* getFileString() { return &fileString_; };
     32    inline lua_State* getLuaState() { return luaState_; };
     33    inline std::string getLuaOutput() { return output_; };
     34    //inline std::string* getFileString() { return &fileString_; };
    3435
    35     static unsigned int getNextQuote(const std::string& text, unsigned int start);
    36     static std::string replaceLuaTags(const std::string& text);
     36    unsigned int getNextQuote(const std::string& text, unsigned int start);
     37    std::string replaceLuaTags(const std::string& text);
    3738
    3839    private:
     40      Script();
     41      static Script* singletonRef;
    3942
    40       //std::list<std::string>& getLevelFileLines();
    41 
    42       static std::string fileString_;
    43       static lua_State* luaState_;
     43      std::string luaSource_;
     44      std::string output_;
     45      lua_State* luaState_;
    4446
    4547  }; // tolua_export
Note: See TracChangeset for help on using the changeset viewer.