Fix getColor, add/get position
This commit is contained in:
		
							parent
							
								
									da050a5630
								
							
						
					
					
						commit
						ca9c33ff54
					
				| 
						 | 
				
			
			@ -35,9 +35,17 @@ end
 | 
			
		|||
 | 
			
		||||
function InputMessage:getColor()
 | 
			
		||||
  local color = {}
 | 
			
		||||
  color.r = msg:getU8()
 | 
			
		||||
  color.g = msg:getU8()
 | 
			
		||||
  color.b = msg:getU8()
 | 
			
		||||
  color.a = msg:getU8()
 | 
			
		||||
  color.r = self:getU8()
 | 
			
		||||
  color.g = self:getU8()
 | 
			
		||||
  color.b = self:getU8()
 | 
			
		||||
  color.a = self:getU8()
 | 
			
		||||
  return color
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function InputMessage:getPosition()
 | 
			
		||||
  local position = {}
 | 
			
		||||
  position.x = self:getU16()
 | 
			
		||||
  position.y = self:getU16()
 | 
			
		||||
  position.z = self:getU8()
 | 
			
		||||
  return position
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -61,3 +61,9 @@ function OutputMessage:addColor(color)
 | 
			
		|||
  self:addU8(color.b)
 | 
			
		||||
  self:addU8(color.a)
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function OutputMessage:addPosition(position)
 | 
			
		||||
  self:addU16(position.x)
 | 
			
		||||
  self:addU16(position.y)
 | 
			
		||||
  self:addU8(position.z)
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue