- Timestamp:
- 06/01/13 17:07:09 (12 years ago)
- Location:
- trunk/src/lua
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lua/lua_glm.cc
r53 r74 335 335 nlua_swizzel_lookup['v'] = 0; 336 336 nlua_swizzel_lookup['3'] = 3; 337 int stack = lua_gettop( L ); 337 338 luaL_requiref(L, "ivec2", luaopen_vec<glm::ivec2>, 1); 338 339 luaL_requiref(L, "ivec3", luaopen_vec<glm::ivec3>, 1); … … 341 342 luaL_requiref(L, "vec3", luaopen_vec<glm::vec3>, 1); 342 343 luaL_requiref(L, "vec4", luaopen_vec<glm::vec4>, 1); 343 } 344 344 lua_settop( L, stack ); 345 } 346 -
trunk/src/lua/lua_state.cc
r51 r74 24 24 } 25 25 26 lua::state::state( bool is_main /*= false*/ ) 27 { 26 lua::state::state( bool load_libs /*= false*/ ) 27 { 28 load_lua_library(); 28 29 m_owner = true; 29 30 L = luaL_newstate( ); … … 33 34 lua_call(L, 1, 0); 34 35 35 if (is_main) 36 { 37 NV_ASSERT( this == get(), "lua_state : another main state created!" ); 36 if ( load_libs ) 37 { 38 38 stack_guard guard( this ); 39 luaopen_base( L ); 40 luaopen_string( L ); 41 luaopen_table( L ); 42 luaopen_math( L ); 43 } 44 45 NV_LOG( nv::LOG_TRACE, is_main ? "Main Lua state created" : "Secondary Lua state created"); 39 static const luaL_Reg lualibs[] = 40 { 41 { "string", luaopen_string }, 42 { "table", luaopen_table }, 43 { "math", luaopen_math }, 44 { NULL, NULL} 45 }; 46 const luaL_Reg *lib = lualibs; 47 for(; lib->func != NULL; lib++) 48 { 49 lib->func( L ); 50 } 51 } 52 53 NV_LOG( nv::LOG_TRACE, "Lua state created" ); 46 54 } 47 55 … … 121 129 } 122 130 123 lua::state* lua::state::get()124 {125 static lua::state main_state(true);126 return &main_state;127 }128 129 131 bool lua::state::push( const std::string& path, bool global ) 130 132 { … … 275 277 for ( int i = 0; i < top; ++i ) 276 278 { 277 NV_LOG( LOG_DEBUG, "#" << i+1 << " - " << lua_typename(L, i+1) << " = " << nlua_typecontent(L, i+1) );279 NV_LOG( LOG_DEBUG, "#" << i+1 << " - " << lua_typename(L, lua_type(L, i+1) ) << " = " << nlua_typecontent(L, i+1) ); 278 280 } 279 281 }
Note: See TracChangeset
for help on using the changeset viewer.