Page 1 of 1

BBcode with syntax highlighting of code snippets

Posted: Wed Mar 15, 2017 8:54 pm
by darkfrei
Hi all!

Is it possible to highlight lua code on the forum?

some

Code: Select all

...
[/color] or [lua]...[/lua] or

Code: Select all

[code=lua]...
[/code]

With highlighting code reading is much easy as without.
code_highlighting_example.PNG
code_highlighting_example.PNG (14.4 KiB) Viewed 1913 times
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}
end
What it could be (but with TABs)
Lua 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/)

Re: BBcode with syntax highlighting of code snippets

Posted: Wed Mar 15, 2017 9:38 pm
by ssilk
I fear, that phpbb is not the best way discuss code.

Re: BBcode with syntax highlighting of code snippets

Posted: Fri May 19, 2017 9:05 am
by InflamedSebi
I support this. There is http://qbnz.com/highlighter/ which should work with phpbb as it started as an addon for this. But i never used it nor installed it ... just leave this here because this might become a thing.