Is it possible to highlight lua code on the forum?
some
Code: Select all
...Code: Select all
[code=lua]...With highlighting code reading is much easy as without. What we have now:
Code: Select all
function rotationToPosition(rotation, position)
	-- makes position from rotation, absolute or relative
	local newPosition = {x=0, y=0}
	local oldPosition = position or {x=0, y=0}
	if 			rotation == 1 then newPosition = {	x=0, 	y=-1}
		elseif 	rotation == 2 then newPosition = {	x=1, 	y=0}
		elseif 	rotation == 3 then newPosition = {	x=0, 	y=1}
		elseif 	rotation == 4 then newPosition = {	x=-1, 	y=0}
		else return nil 
	end
	return {x = oldPosition.x + newPosition.x, y = oldPosition.y + newPosition.y}
endLua wrote:function rotationToPosition(rotation, position)
-- makes position from rotation, absolute or relative
local newPosition = {x=0, y=0}
local oldPosition = position or {x=0, y=0}
if rotation == 1 then newPosition = { x=0, y=-1}
elseif rotation == 2 then newPosition = { x=1, y=0}
elseif rotation == 3 then newPosition = { x=0, y=1}
elseif rotation == 4 then newPosition = { x=-1, y=0}
else return nil
end
return {x = oldPosition.x + newPosition.x, y = oldPosition.y + newPosition.y}
end
Generated by the BBify'r (http://clrhome.org/bbify/)




