Changeset 181 for trunk/src/lua


Ignore:
Timestamp:
07/30/13 04:44:15 (12 years ago)
Author:
epyon
Message:
  • string - string_length template
  • lua/path - power tool, universal lua path
  • lua_state - now uses lua/path for table_guard constructors
Location:
trunk/src/lua
Files:
1 added
1 edited

Legend:

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

    r163 r181  
    198198}
    199199
    200 lua::table_guard::table_guard( lua::state* lstate, const std::string& table, bool global )
     200lua::table_guard::table_guard( lua::state* lstate, const path& p, bool global )
    201201        : L(lstate), m_guard(lstate)
    202202{
    203         L->push( table, global );
    204 }
    205 
    206 lua::table_guard::table_guard( lua::state* lstate, const std::string& table, int index, bool global )
    207         : L(lstate), m_guard(lstate)
    208 {
    209         L->push( table, global );
    210         lua_rawgeti( L->L, -1, index );
    211 }
    212 
    213 lua::table_guard::table_guard( lua::state* lstate, const std::string& table, const std::string& index, bool global /*= true */ )
    214         : L(lstate), m_guard(lstate)
    215 {
    216         L->push( table, global );
    217         lua_pushstring( L->L, index.c_str() );
    218         lua_rawget( L->L, -2 );
    219 }
    220 
    221 lua::table_guard::table_guard( const table_guard& parent, const std::string& index )
     203        if ( !p.resolve( L->get_raw(), global ) )
     204        {
     205                // TODO : error handling
     206        }
     207}
     208
     209lua::table_guard::table_guard( const table_guard& parent, const path& p )
    222210        : L( parent.L ), m_guard( parent.L )
    223211{
    224         lua_getfield( L->L, -1, index.c_str() );
    225 }
    226 
    227 lua::table_guard::table_guard( const table_guard& parent, int index )
    228         : L( parent.L ), m_guard( parent.L )
    229 {
    230         lua_rawgeti( L->L, -1, index );
     212        if ( !p.resolve( L->get_raw(), false ) )
     213        {
     214                // TODO : error handling
     215        }
    231216}
    232217
Note: See TracChangeset for help on using the changeset viewer.