Ignore:
Timestamp:
08/20/14 12:50:51 (11 years ago)
Author:
epyon
Message:
  • engine category
  • resource system beginnings
  • early effects system
  • plenty minor changes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lua/lua_nova.cc

    r217 r316  
    680680        lua_rawget( L, -2 );
    681681
    682         if ( !lua_isnil( L, -1 ) ) luaL_error( L, "lua.nova - storage \"%s\" already registered!", lua_tolstring( L, lua_upvalueindex(1), 0 ) );
     682        if ( !lua_isnil( L, -1 ) ) luaL_error( L, "lua.nova - storage \"%s\" already registered!", lua_tolstring( L, 1, 0 ) );
    683683
    684684        lua_newtable( L ); // g t
     
    805805        lua_settop( L, stack );
    806806}
     807
     808void nv::lua::register_storage( state* a_state, const string& name, const string& constructor_name )
     809{
     810        // TODO: error checking
     811        lua_State* L = a_state->get_raw();
     812        int stack = lua_gettop( L );
     813        // TODO: check if nova is loaded
     814        lua_pushcfunction( L, nova_register_storage );
     815        lua_pushstring( L, name.c_str() );
     816        lua_call( L, 1, 1 );
     817        lua_setglobal( L, constructor_name.c_str() );
     818        lua_settop( L, stack );
     819}
Note: See TracChangeset for help on using the changeset viewer.