Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7945


Ignore:
Timestamp:
Feb 21, 2011, 3:47:29 AM (14 years ago)
Author:
rgrieder
Message:

Removed workarounds for Lua 5.0 in LuaState class.

Location:
code/branches/kicklib/src/libraries/core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/kicklib/src/libraries/core/LuaState.cc

    r7941 r7945  
    6060        luaState_ = lua_open();
    6161        Loki::ScopeGuard luaStateGuard = Loki::MakeGuard(&lua_close, luaState_);
    62 #if LUA_VERSION_NUM == 501
    6362        luaL_openlibs(luaState_);
    64 #else
    65         luaopen_base(luaState_);
    66         luaopen_string(luaState_);
    67         luaopen_table(luaState_);
    68         luaopen_math(luaState_);
    69         luaopen_io(luaState_);
    70         luaopen_debug(luaState_);
    71 #endif
    7263
    7364        // Open all available tolua interfaces
     
    187178        }
    188179
    189 #if LUA_VERSION_NUM != 501
    190         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 #else
    195180        int error = luaL_loadbuffer(luaState_, code.c_str(), code.size(), chunkname.c_str());
    196 #endif
    197181
    198182        switch (error)
     
    293277    }
    294278
    295 #if LUA_VERSION_NUM != 501
    296     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 #endif
    306 
    307279    /*static*/ bool LuaState::addToluaInterface(int (*function)(lua_State*), const std::string& name)
    308280    {
  • code/branches/kicklib/src/libraries/core/LuaState.h

    r7401 r7945  
    113113        shared_ptr<ResourceInfo> getFileInfo(const std::string& filename);
    114114
    115 #if LUA_VERSION_NUM != 501
    116         struct LoadS
    117         {
    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 #endif
    124 
    125115        std::stringstream output_;
    126116        lua_State* luaState_;
Note: See TracChangeset for help on using the changeset viewer.