Get SaintAxe&Ror SpeechMaker Now
And build your conversations easily !
 
The wall - Read LUA higlighted source code
 

Need to share Highlighted and indented LUA source code ?
The wall is at your disposal for posting some LUA code in order to share it with your friends.
WRITE YOUR CODE ON THE WALL

You can also use the anonymous account if you don't want to register :
Login -> Anonymous Password -> anonymous


Link : Official LUA Documentation

Editors entrance
Login :   Pass :
 
: Remember me   
 
Not yet registered : Register Now
 
 
Back to summary
 
Posted by SaintAxe&Ror on : 2011-02-20 10:52:23

SAR ]> The Wall : Highlight your code

Here is a demonstration of how to share some LUA source code with color highlighting (like in Mission Editor) and with a clean indentation.

Highlight is automatic.
Text that is wraped with [ code][ /code] tags will be processed at the time of displaying.

Indentation is a manual task, so you may indent the text the way you want.

Here is an example of LUA source code :
(Note : The text above is not wrapped with code tags, it will not be highlighted)
spawnDistance = 200 -- increasing/decreasing will allow units to spawn close/far

function isFarEnough(unitName, waypointName)
	if not OFP:isAlive(unitName) then
		return true
	else
		local posU = {OFP:getPosition(unitName)}
		local posW = {OFP:getPosition(waypointName)}
		
		local distX = math.floor(math.max(posU[1], posW[1]) - math.min(posU[1], posW[1]))
		local distY = math.floor(math.max(posU[2], posW[2]) - math.min(posU[2], posW[2]))

		if distX > spawnDistance
			or distY > spawnDistance
		then
			return true
		else
			return false
		end
	end
end 

When the snippet is saved in the database, a message will dishow you the link you should send to your friends in order they can reach the page that displays the snippet.

This page is hosted here = http://sar.n1bus.eu/read-wall/1

Also, save the password that has been created for you in order to edit or delete the page (correct source code or add some comments, text, etc).

Be aware that the snippet you create here are visible by everyone.
This service is totally free.
 
Back to summary