- Timestamp:
- 08/03/13 04:40:16 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lua/lua_state.cc
r181 r185 264 264 } 265 265 266 void lua::table_guard::call_get() 267 { 268 lua_gettable( L->L, -2 ); 269 } 270 271 void lua::table_guard::call_get_raw() 272 { 273 lua_rawget( L->L, -2 ); 274 } 275 276 266 277 void lua::table_guard::get_raw_flags( const std::string& element, uint8* data, uint32 count ) 267 278 { … … 375 386 } 376 387 } 388 389 int lua::state::call_function( int nargs, int nresults ) 390 { 391 int status = lua_pcall( L, nargs, nresults, 0 ); 392 if ( status != 0 ) 393 { 394 std::string error = lua_tostring( L, -1 ); 395 lua_pop( L, 1 ); 396 NV_LOG( LOG_ERROR, "Lua error : " << error ) 397 } 398 return status; 399 } 400 401 bool lua::state::push_function( const path& p, bool global ) 402 { 403 if ( !p.resolve( L, global ) ) 404 { 405 lua_pop( L, 1 ); 406 NV_LOG( LOG_ERROR, "Lua error : not a valid path - " + p.to_string() ); 407 return false; 408 } 409 410 if ( !lua_isfunction( L, -1 ) ) 411 { 412 lua_pop( L, 1 ); 413 NV_LOG( LOG_ERROR, "Lua error : not a valid function - " + p.to_string() ); 414 return false; 415 } 416 return true; 417 }
Note: See TracChangeset
for help on using the changeset viewer.