Changeset 288 for trunk/src/lua/lua_state.cc
- Timestamp:
- 07/23/14 17:37:44 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lua/lua_state.cc
r265 r288 148 148 { 149 149 lua_getfield( m_state, -1, element.c_str() ); 150 bool result = lua_isnil( m_state, -1);150 bool result = !( lua_isnil( m_state, -1 ) ); 151 151 lua_pop( m_state, 1 ); 152 152 return result; … … 189 189 lua_getfield( m_state, -1, element.c_str() ); 190 190 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 196 float 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; 191 200 lua_pop( m_state, 1 ); 192 201 return result;
Note: See TracChangeset
for help on using the changeset viewer.