Ignore:
Timestamp:
06/14/15 14:31:00 (10 years ago)
Author:
epyon
Message:
  • got rid of exceptions
  • assert enhancements
  • lots of minor cleanup
File:
1 edited

Legend:

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

    r399 r403  
    1515
    1616// stack_guard
     17
     18#define NV_LUA_ABORT( func, ... ) \
     19        NV_LOG_CRITICAL( "lua::" func " : ", __VA_ARGS__ ) \
     20        NV_ABORT( "lua::" func " : critical error!" )
     21
    1722
    1823lua::stack_guard::stack_guard( lua::state* aL )
     
    424429        if ( lua_isnil( m_state, -1 ) )
    425430        {
    426                 NV_THROW( runtime_error, lua_name.to_string() + " type not registered!" );
     431                NV_LUA_ABORT( "state::register_object", lua_name, " type not registered!" );
    427432        }
    428433        deep_pointer_copy( -1, o );
     
    436441        if ( lua_isnil( m_state, -1 ) )
    437442        {
    438                 NV_THROW( runtime_error, storage.to_string() + " storage not registered!" );
     443                NV_LUA_ABORT( "state::register_proto", "\"", storage, "\" storage not registered!" );
    439444        }
    440445        lua_getfield( m_state, -1, id.data() );
    441446        if ( lua_isnil( m_state, -1 ) )
    442447        {
    443                 NV_THROW( runtime_error, id.to_string() + " not found in " + storage.to_string() + " storage!" );
     448                NV_LUA_ABORT( "state::register_proto", "\"", id, "\" not found in \"", storage, "\"!" );
    444449        }
    445450        return lua::ref( luaL_ref( m_state, LUA_REGISTRYINDEX ) );
     
    452457        if ( lua_isnil( m_state, -1 ) )
    453458        {
    454                 NV_THROW( runtime_error, lua_name.to_string() + " type not registered!" );
     459                NV_LUA_ABORT( "state::register_native_object_method", "\"", lua_name, "\" type not registered!" );
    455460        }
    456461        lua_pushcfunction( m_state, f );
     
    502507        if ( has_functions || has_metatable )
    503508        {
    504                 lua_pushstring( m_state, "__ptr" );
     509                lua_pushliteral( m_state, "__ptr" );
    505510                lua_pushlightuserdata( m_state, obj );
    506511                lua_rawset( m_state, -3 );
     
    569574        if ( lua_isnil( m_state, -1 ) )
    570575        {
    571                 NV_THROW( runtime_error, name.to_string() + " type not registered!" );
     576                NV_LUA_ABORT( "state::register_singleton", "\"", name, "\" type not registered!" );
    572577        }
    573578        deep_pointer_copy( -1, o );
Note: See TracChangeset for help on using the changeset viewer.