- Timestamp:
- 08/04/13 06:37:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lua/lua_state.cc
r187 r188 216 216 } 217 217 218 size_t lua::table_guard::get_size() 219 { 220 return lua_rawlen( L->get_raw(), -1 ); 221 } 222 223 218 224 bool lua::table_guard::has_field( const string& element ) 219 225 { … … 248 254 } 249 255 256 unsigned lua::table_guard::get_unsigned( const string& element, unsigned defval /*= "" */ ) 257 { 258 lua_getfield( L->L, -1, element.c_str() ); 259 int result = lua_type( L->L, -1 ) == LUA_TNUMBER ? lua_tounsigned( L->L, -1 ) : defval; 260 lua_pop( L->L, 1 ); 261 return result; 262 } 263 250 264 double lua::table_guard::get_double( const string& element, double defval /*= "" */ ) 251 265 { … … 274 288 } 275 289 290 bool nv::lua::table_guard::is_defined( const path& p ) 291 { 292 return L->is_defined( p, false ); 293 } 276 294 277 295 void lua::table_guard::get_raw_flags( const std::string& element, uint8* data, uint32 count ) … … 393 411 } 394 412 413 414 bool nv::lua::state::is_defined( const path& p, bool global ) 415 { 416 if ( !p.resolve( L, global ) ) 417 { 418 return false; 419 } 420 bool result = !lua_isnil( L, -1 ); 421 lua_pop( L, 1 ); 422 return result; 423 } 424 395 425 int lua::state::call_function( int nargs, int nresults ) 396 426 {
Note: See TracChangeset
for help on using the changeset viewer.