Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1029


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

some changes

Location:
code/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/cmake/FindLua.cmake

    r1021 r1029  
    2727        /usr/include/lua50
    2828        /usr/local/include/lua50
    29         /usr/pack/lua-5.0.3-sd/include/)
     29        /usr/pack/lua-5.0.3-sd/include)
    3030ENDIF (NOT Lua_INCLUDE_DIR)
    31 MESSAGE(STATUS ${Lua_INCLUDE_DIR})
    3231
    3332IF (NOT Lua_LIBRARIES)
    34 FIND_LIBRARY(Lua_LIBRARIES lua50 lua
     33FIND_LIBRARY(Lua_LIBRARIES lua50
    3534        /usr/lib
    36         /usr/local/lib
    37         /usr/pack/lua-5.0.3-sd/i686-debian-linux3.1/lib/)
     35        /usr/local/lib)
    3836
    39 FIND_LIBRARY(Lua_LIBRARY lualib50 lualib
     37FIND_LIBRARY(Lua_LIBRARY lualib50
    4038        /usr/lib
    41         /usr/local/lib
    42         /usr/pack/lua-5.0.3-sd/i686-debian-linux3.1/lib/)
     39        /usr/local/lib)
    4340
    44 MESSAGE(STATUS ${Lua_LIBRARY})
    45 MESSAGE(STATUS ${Lua_LIBRARIES})
     41SET(Lua_LIBRARIES ${Lua_LIBRARIES} ${Lua_LIBRARY})
     42
     43ENDIF (NOT Lua_LIBRARIES)
     44
     45IF (NOT Lua_LIBRARIES)
     46FIND_LIBRARY(Lua_LIBRARIES lua
     47        /usr/pack/lua-5.0.3-sd/i686-debian-linux3.1/lib)
     48
     49FIND_LIBRARY(Lua_LIBRARY lualib
     50        /usr/pack/lua-5.0.3-sd/i686-debian-linux3.1/lib)
    4651
    4752SET(Lua_LIBRARIES ${Lua_LIBRARIES} ${Lua_LIBRARY})
  • 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.