Changeset 288 for trunk/src/lua


Ignore:
Timestamp:
07/23/14 17:37:44 (11 years ago)
Author:
epyon
Message:
  • unified animation_entry class
  • virtuals removed from animation_entry
  • lua_table - added missing get_float
  • lua_table - fixed has_field
File:
1 edited

Legend:

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

    r265 r288  
    148148{
    149149        lua_getfield( m_state, -1, element.c_str() );
    150         bool result = lua_isnil( m_state, -1 );
     150        bool result = !( lua_isnil( m_state, -1 ) );
    151151        lua_pop( m_state, 1 );
    152152        return result;
     
    189189        lua_getfield( m_state, -1, element.c_str() );
    190190        double result = lua_type( m_state, -1 ) == LUA_TNUMBER ? lua_tonumber( m_state, -1 ) : defval;
     191        lua_pop( m_state, 1 );
     192        return result;
     193}
     194
     195
     196float nv::lua::table_guard::get_float( const std::string& element, float defval /*= 0.0 */ )
     197{
     198        lua_getfield( m_state, -1, element.c_str() );
     199        float result = lua_type( m_state, -1 ) == LUA_TNUMBER ? (float)lua_tonumber( m_state, -1 ) : defval;
    191200        lua_pop( m_state, 1 );
    192201        return result;
Note: See TracChangeset for help on using the changeset viewer.