예제 #1
0
 void set_error_from_top_of_stack(lua_State*l)
 {
     int error_index = lua_gettop(l);
     push_error_id_str(l);
     lua_pushvalue(l,error_index);
     lua_settable(l, LUA_REGISTRYINDEX);
 }
예제 #2
0
		void set_error_from_top_of_stack_and_pop_the_error(lua_State* vm)
		{
			int error_index = lua_gettop(vm);
			push_error_id_str(vm);
			lua_pushvalue(vm, error_index);
			lua_settable(vm, LUA_REGISTRYINDEX);
			lua_pop(vm, 1);
		}
예제 #3
0
 std::string get_last_error(lua_State*l)
 {
     push_error_id_str(l);
     lua_gettable(l, LUA_REGISTRYINDEX);
     std::string error;
     if( (! lua_isnil(l,-1 ) ) && (lua_type(l, -1) == LUA_TSTRING ))
         error = lua_tolstring(l,-1,0);
     lua_pop( l, 1);
     return error;
 }
예제 #4
0
	std::string get_last_error(lua_State* vm)
	{
		push_error_id_str(vm);
		lua_gettable(vm, LUA_REGISTRYINDEX);
		std::string error;
		if ( lua_type(vm, -1) == LUA_TSTRING )
		{
			size_t len(0);
			char const* str = lua_tolstring(vm, -1, &len);
			error = std::string(str, len);
		}
		lua_pop(vm, 1);
		return error;
	}
예제 #5
0
 void reset_error_value(lua_State*l)
 {
     push_error_id_str(l);
     lua_pushnil(l);
     lua_settable(l, LUA_REGISTRYINDEX);
 }
예제 #6
0
	void reset_error_value(lua_State* vm)
	{
		push_error_id_str(vm);
		lua_pushnil(vm);
		lua_settable(vm, LUA_REGISTRYINDEX);
	}