Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 11, 2008, 7:01:02 PM (17 years ago)
Author:
bknecht
Message:

some changes

Location:
code/trunk/src/orxonox/core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/core/Script.cc

    r1024 r1029  
    4949    luaState_ = lua_open();
    5050    luaSource_ = "";
     51#if LUA_VERSION_NUM == 501
    5152    luaL_openlibs(luaState_);
     53#else
     54    luaopen_base(luaState_);
     55    luaopen_string(luaState_);
     56    luaopen_table(luaState_);
     57    luaopen_math(luaState_);
     58    luaopen_io(luaState_);
     59    luaopen_debug(luaState_);
     60#endif
    5261    tolua_orxonox_open(luaState_);
    5362    output_;
     
    97106    std::string init = "local scr = orxonox.Script:getInstance()\nprint = function(s)\nscr:luaPrint(s)\nend\n";
    98107    init += luaSource_;
     108#if LUA_VERSION_NUM == 501
    99109    error = luaL_loadstring(luaState_, init.c_str());
     110#else
     111    error = lua_load(luaState_, &orxonox::Script::lua_Chunkreader, init.c_str(), "init");
     112#endif
    100113    if (error == 0)
    101114      error = lua_pcall(luaState_, 0, 0, 0);
    102115    if (error != 0) COUT(2) << "Error in Lua-script: " << lua_tostring(luaState_, -1) << std::endl;
    103116  }
    104 
    105117
    106118  unsigned int Script::getNextQuote(const std::string& text, unsigned int start)
     
    143155      std::map<unsigned int, bool>::iterator it2 = it;
    144156      bool bBetweenQuotes = false;
    145       bool bBetweenTags = false;
    146157      unsigned int pos = 0;
    147158      while ((pos = getNextQuote(text, pos)) != std::string::npos)
  • code/trunk/src/orxonox/core/Script.h

    r1021 r1029  
    3030    void luaPrint(std::string str); // tolua_export
    3131
     32#if LUA_VERSION_NUM != 501
     33    inline const char * lua_Chunkreader(lua_State *L, void *data, size_t *size) { return NULL;};
     34#endif
     35
    3236    inline lua_State* getLuaState() { return luaState_; };
    3337    inline std::string getLuaOutput() { return output_; };
Note: See TracChangeset for help on using the changeset viewer.