Ignore:
Timestamp:
08/12/14 01:51:21 (11 years ago)
Author:
epyon
Message:
  • lua_state - state_wrapper::get functions with default values
  • lua_values - support for value get with default
  • lua_state - table error logging (need real handling)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/nv/lua/lua_state.hh

    r296 r305  
    130130                        }
    131131
     132                        template< typename R >
     133                        R get( const path& p, const R& def )
     134                        {
     135                                if ( p.resolve( m_state, m_global ) )
     136                                {
     137                                        return detail::pop_return_value<R>( m_state, def );
     138                                }
     139                                return R();
     140                        }
     141
     142                        template< typename R, typename T >
     143                        R get( const T& key, const R& def )
     144                        {
     145                                if ( m_global ) push_global_table();
     146                                detail::push_value( m_state, key );
     147                                call_get();
     148                                if ( m_global ) pop_global_table();
     149                                return detail::pop_return_value<R>( m_state, def );
     150                        }
     151
     152                        template< typename R, typename T >
     153                        R raw_get( const T& key, const R& def )
     154                        {
     155                                if ( m_global ) push_global_table();
     156                                detail::push_value( m_state, key );
     157                                call_get_raw();
     158                                if ( m_global ) pop_global_table();
     159                                return detail::pop_return_value<R>( m_state, def );
     160                        }
    132161                        bool is_defined( const path& p ) { return is_defined( p, m_global ); }
    133162                        void register_native_function( lfunction f, const char* name );
Note: See TracChangeset for help on using the changeset viewer.