Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1807 for code


Ignore:
Timestamp:
Sep 21, 2008, 7:13:06 PM (16 years ago)
Author:
rgrieder
Message:

modification to ceguilua 0.5 in order to work with lua 5.1.3

Location:
code/branches/ceguilua/src/ceguilua-0.5.0b/ceguilua
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/ceguilua/src/ceguilua-0.5.0b/ceguilua/CEGUILua.cpp

    r1803 r1807  
    3535
    3636// include Lua libs and tolua++
    37 extern "C" {
    38 #include "lua.h"
    39 #include "lualib.h"
    40 #include "lauxlib.h"
    41 }
     37#include "lua/lua.hpp"
     38#include "tolua/tolua++.h"
    4239
    4340#include "tolua++.h"
     
    5653LuaScriptModule::LuaScriptModule()
    5754{
    58         // create a lua state
    59         d_ownsState = true;
    60         d_state = lua_open();
    61 
    62         // init all standard libraries
    63         luaopen_base(d_state);
    64         luaopen_io(d_state);
    65         luaopen_string(d_state);
    66         luaopen_table(d_state);
    67         luaopen_math(d_state);
    68 #if defined(DEBUG) || defined (_DEBUG)
    69         luaopen_debug(d_state);
    70 #endif
    71 
    72         setModuleIdentifierString();
     55    static const luaL_Reg lualibs[] = {
     56        {"", luaopen_base},
     57        {LUA_LOADLIBNAME, luaopen_package},
     58        {LUA_TABLIBNAME, luaopen_table},
     59        {LUA_IOLIBNAME, luaopen_io},
     60        {LUA_OSLIBNAME, luaopen_os},
     61        {LUA_STRLIBNAME, luaopen_string},
     62        {LUA_MATHLIBNAME, luaopen_math},
     63    #if defined(DEBUG) || defined (_DEBUG)
     64        {LUA_DBLIBNAME, luaopen_debug},
     65    #endif
     66        {0, 0}
     67    };
     68
     69    // create a lua state
     70    d_ownsState = true;
     71    d_state = lua_open();
     72
     73    // init all standard libraries
     74    const luaL_Reg *lib = lualibs;
     75    for (; lib->func; lib++)
     76    {
     77        lua_pushcfunction(d_state, lib->func);
     78        lua_pushstring(d_state, lib->name);
     79        lua_call(d_state, 1, 0);
     80    }
     81
     82    setModuleIdentifierString();
    7383}
    7484
  • code/branches/ceguilua/src/ceguilua-0.5.0b/ceguilua/CEGUILuaFunctor.cpp

    r1803 r1807  
    3434
    3535// include Lua libs and tolua++
    36 extern "C" {
    37 #include "lua.h"
    38 #include "lualib.h"
    39 #include "lauxlib.h"
    40 }
    41 
    42 #include "tolua++.h"
     36#include "lua/lua.hpp"
     37#include "tolua/tolua++.h"
    4338
    4439// Start of CEGUI namespace section
  • code/branches/ceguilua/src/ceguilua-0.5.0b/ceguilua/lua_CEGUI.cpp

    r1803 r1807  
    99#include "string.h"
    1010
    11 #include "tolua++.h"
     11#include "tolua/tolua++.h"
    1212
    1313/* Exported function */
Note: See TracChangeset for help on using the changeset viewer.