Changeset 7945 for code/branches/kicklib
- Timestamp:
- Feb 21, 2011, 3:47:29 AM (14 years ago)
- Location:
- code/branches/kicklib/src/libraries/core
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/kicklib/src/libraries/core/LuaState.cc
r7941 r7945 60 60 luaState_ = lua_open(); 61 61 Loki::ScopeGuard luaStateGuard = Loki::MakeGuard(&lua_close, luaState_); 62 #if LUA_VERSION_NUM == 50163 62 luaL_openlibs(luaState_); 64 #else65 luaopen_base(luaState_);66 luaopen_string(luaState_);67 luaopen_table(luaState_);68 luaopen_math(luaState_);69 luaopen_io(luaState_);70 luaopen_debug(luaState_);71 #endif72 63 73 64 // Open all available tolua interfaces … … 187 178 } 188 179 189 #if LUA_VERSION_NUM != 501190 LoadS ls;191 ls.s = code.c_str();192 ls.size = code.size();193 int error = lua_load(luaState_, &orxonox::LuaState::lua_Chunkreader, &ls, chunkname.c_str());194 #else195 180 int error = luaL_loadbuffer(luaState_, code.c_str(), code.size(), chunkname.c_str()); 196 #endif197 181 198 182 switch (error) … … 293 277 } 294 278 295 #if LUA_VERSION_NUM != 501296 const char * LuaState::lua_Chunkreader(lua_State *L, void *data, size_t *size)297 {298 LoadS* ls = static_cast<LoadS*>(data);299 if (ls->size == 0)300 return NULL;301 *size = ls->size;302 ls->size = 0;303 return ls->s;304 }305 #endif306 307 279 /*static*/ bool LuaState::addToluaInterface(int (*function)(lua_State*), const std::string& name) 308 280 { -
code/branches/kicklib/src/libraries/core/LuaState.h
r7401 r7945 113 113 shared_ptr<ResourceInfo> getFileInfo(const std::string& filename); 114 114 115 #if LUA_VERSION_NUM != 501116 struct LoadS117 {118 const char* s;119 size_t size;120 };121 122 static const char * lua_Chunkreader(lua_State *L, void *data, size_t *size);123 #endif124 125 115 std::stringstream output_; 126 116 lua_State* luaState_;
Note: See TracChangeset
for help on using the changeset viewer.