- Timestamp:
- 06/02/13 18:38:01 (12 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nv/lua/lua_state.hh
r79 r86 30 30 public: 31 31 stack_guard( state* L ); 32 stack_guard( state& L ); 32 33 int get_level() const { return m_level; } 33 34 ~stack_guard(); … … 61 62 friend class table_guard; 62 63 public: 63 state( bool load_libs = false );64 state( lua_State* state );64 explicit state( bool load_libs = false ); 65 explicit state( lua_State* state ); 65 66 bool do_string( const std::string& code, const std::string& name, int rvalues = 0 ); 66 67 bool do_stream( std::istream& stream, const std::string& name ); … … 71 72 reference register_object( object * o ); 72 73 void unregister_object( object * o ); 74 operator lua_State*() { return L; } 73 75 ~state(); 74 76 private: -
trunk/src/lua/lua_state.cc
r79 r86 17 17 lua::stack_guard::stack_guard( lua::state* L ) 18 18 : L(L), m_level( lua_gettop(L->L) ) 19 { 20 21 } 22 23 lua::stack_guard::stack_guard( lua::state& L ) 24 : L(&L), m_level( lua_gettop((&L)->L) ) 19 25 { 20 26 -
trunk/tests/lualib_test/lualib_test.cc
r79 r86 28 28 { 29 29 nv::lua::state state( true ); 30 nlua_register_glm( state .get_raw());30 nlua_register_glm( state ); 31 31 // run the Lua script 32 32 state.do_file( "init.lua" ); … … 34 34 for (;;) 35 35 { 36 nv::lua::stack_guard guard( &state );36 nv::lua::stack_guard guard( state ); 37 37 int stack = guard.get_level(); 38 38 std::string input; … … 56 56 if ( !result ) 57 57 { 58 std::string error = lua_tostring( state .get_raw(), -1 );58 std::string error = lua_tostring( state, -1 ); 59 59 std::cout << "ERROR : " << error << std::endl; 60 60 continue; 61 61 } 62 62 63 if (lua_gettop( state .get_raw()) > stack)63 if (lua_gettop( state ) > stack) 64 64 { 65 for ( int i = stack+1; i <= lua_gettop( state .get_raw()); ++i )65 for ( int i = stack+1; i <= lua_gettop( state ); ++i ) 66 66 { 67 std::cout << nlua_typecontent( state .get_raw(), i ) << std::endl;67 std::cout << nlua_typecontent( state, i ) << std::endl; 68 68 } 69 69 }
Note: See TracChangeset
for help on using the changeset viewer.