Changeset 1029
- Timestamp:
- Apr 11, 2008, 7:01:02 PM (17 years ago)
- Location:
- code/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/cmake/FindLua.cmake
r1021 r1029 27 27 /usr/include/lua50 28 28 /usr/local/include/lua50 29 /usr/pack/lua-5.0.3-sd/include /)29 /usr/pack/lua-5.0.3-sd/include) 30 30 ENDIF (NOT Lua_INCLUDE_DIR) 31 MESSAGE(STATUS ${Lua_INCLUDE_DIR})32 31 33 32 IF (NOT Lua_LIBRARIES) 34 FIND_LIBRARY(Lua_LIBRARIES lua50 lua33 FIND_LIBRARY(Lua_LIBRARIES lua50 35 34 /usr/lib 36 /usr/local/lib 37 /usr/pack/lua-5.0.3-sd/i686-debian-linux3.1/lib/) 35 /usr/local/lib) 38 36 39 FIND_LIBRARY(Lua_LIBRARY lualib50 lualib37 FIND_LIBRARY(Lua_LIBRARY lualib50 40 38 /usr/lib 41 /usr/local/lib 42 /usr/pack/lua-5.0.3-sd/i686-debian-linux3.1/lib/) 39 /usr/local/lib) 43 40 44 MESSAGE(STATUS ${Lua_LIBRARY}) 45 MESSAGE(STATUS ${Lua_LIBRARIES}) 41 SET(Lua_LIBRARIES ${Lua_LIBRARIES} ${Lua_LIBRARY}) 42 43 ENDIF (NOT Lua_LIBRARIES) 44 45 IF (NOT Lua_LIBRARIES) 46 FIND_LIBRARY(Lua_LIBRARIES lua 47 /usr/pack/lua-5.0.3-sd/i686-debian-linux3.1/lib) 48 49 FIND_LIBRARY(Lua_LIBRARY lualib 50 /usr/pack/lua-5.0.3-sd/i686-debian-linux3.1/lib) 46 51 47 52 SET(Lua_LIBRARIES ${Lua_LIBRARIES} ${Lua_LIBRARY}) -
code/trunk/src/orxonox/core/Script.cc
r1024 r1029 49 49 luaState_ = lua_open(); 50 50 luaSource_ = ""; 51 #if LUA_VERSION_NUM == 501 51 52 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 52 61 tolua_orxonox_open(luaState_); 53 62 output_; … … 97 106 std::string init = "local scr = orxonox.Script:getInstance()\nprint = function(s)\nscr:luaPrint(s)\nend\n"; 98 107 init += luaSource_; 108 #if LUA_VERSION_NUM == 501 99 109 error = luaL_loadstring(luaState_, init.c_str()); 110 #else 111 error = lua_load(luaState_, &orxonox::Script::lua_Chunkreader, init.c_str(), "init"); 112 #endif 100 113 if (error == 0) 101 114 error = lua_pcall(luaState_, 0, 0, 0); 102 115 if (error != 0) COUT(2) << "Error in Lua-script: " << lua_tostring(luaState_, -1) << std::endl; 103 116 } 104 105 117 106 118 unsigned int Script::getNextQuote(const std::string& text, unsigned int start) … … 143 155 std::map<unsigned int, bool>::iterator it2 = it; 144 156 bool bBetweenQuotes = false; 145 bool bBetweenTags = false;146 157 unsigned int pos = 0; 147 158 while ((pos = getNextQuote(text, pos)) != std::string::npos) -
code/trunk/src/orxonox/core/Script.h
r1021 r1029 30 30 void luaPrint(std::string str); // tolua_export 31 31 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 32 36 inline lua_State* getLuaState() { return luaState_; }; 33 37 inline std::string getLuaOutput() { return output_; };
Note: See TracChangeset
for help on using the changeset viewer.