[Orxonox-commit 3254] r7945 - code/branches/kicklib/src/libraries/core
rgrieder at orxonox.net
rgrieder at orxonox.net
Mon Feb 21 03:47:29 CET 2011
Author: rgrieder
Date: 2011-02-21 03:47:29 +0100 (Mon, 21 Feb 2011)
New Revision: 7945
Modified:
code/branches/kicklib/src/libraries/core/LuaState.cc
code/branches/kicklib/src/libraries/core/LuaState.h
Log:
Removed workarounds for Lua 5.0 in LuaState class.
Modified: code/branches/kicklib/src/libraries/core/LuaState.cc
===================================================================
--- code/branches/kicklib/src/libraries/core/LuaState.cc 2011-02-21 02:47:04 UTC (rev 7944)
+++ code/branches/kicklib/src/libraries/core/LuaState.cc 2011-02-21 02:47:29 UTC (rev 7945)
@@ -59,16 +59,7 @@
// Create new lua state and configure it
luaState_ = lua_open();
Loki::ScopeGuard luaStateGuard = Loki::MakeGuard(&lua_close, luaState_);
-#if LUA_VERSION_NUM == 501
luaL_openlibs(luaState_);
-#else
- luaopen_base(luaState_);
- luaopen_string(luaState_);
- luaopen_table(luaState_);
- luaopen_math(luaState_);
- luaopen_io(luaState_);
- luaopen_debug(luaState_);
-#endif
// Open all available tolua interfaces
this->openToluaInterfaces(luaState_);
@@ -186,14 +177,7 @@
errorHandler = 0;
}
-#if LUA_VERSION_NUM != 501
- LoadS ls;
- ls.s = code.c_str();
- ls.size = code.size();
- int error = lua_load(luaState_, &orxonox::LuaState::lua_Chunkreader, &ls, chunkname.c_str());
-#else
int error = luaL_loadbuffer(luaState_, code.c_str(), code.size(), chunkname.c_str());
-#endif
switch (error)
{
@@ -292,18 +276,6 @@
return IOConsole::exists();
}
-#if LUA_VERSION_NUM != 501
- const char * LuaState::lua_Chunkreader(lua_State *L, void *data, size_t *size)
- {
- LoadS* ls = static_cast<LoadS*>(data);
- if (ls->size == 0)
- return NULL;
- *size = ls->size;
- ls->size = 0;
- return ls->s;
- }
-#endif
-
/*static*/ bool LuaState::addToluaInterface(int (*function)(lua_State*), const std::string& name)
{
for (ToluaInterfaceMap::const_iterator it = toluaInterfaces_s.begin(); it != toluaInterfaces_s.end(); ++it)
Modified: code/branches/kicklib/src/libraries/core/LuaState.h
===================================================================
--- code/branches/kicklib/src/libraries/core/LuaState.h 2011-02-21 02:47:04 UTC (rev 7944)
+++ code/branches/kicklib/src/libraries/core/LuaState.h 2011-02-21 02:47:29 UTC (rev 7945)
@@ -112,16 +112,6 @@
private:
shared_ptr<ResourceInfo> getFileInfo(const std::string& filename);
-#if LUA_VERSION_NUM != 501
- struct LoadS
- {
- const char* s;
- size_t size;
- };
-
- static const char * lua_Chunkreader(lua_State *L, void *data, size_t *size);
-#endif
-
std::stringstream output_;
lua_State* luaState_;
bool bIsRunning_;
More information about the Orxonox-commit
mailing list