HOW-TO: Use basic if's and ends
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

HOW-TO: Use basic if's and ends

Started by pHaTTy, 25 December, 2003, 20:37:06

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

pHaTTy

ok while i here a quick little thread to remind you if the tabbing system

for if end

for for end

== is if it eqals

= is it make it equal


ok tabs

ok here is one of a projects main function ive been working on, i have removed lotsa stuff so you see only an example this will not work for you

function Main()
SendToAll("test")
RestartMain()
KillFunctions()
ChecksRestarts()
UpdateText(Retarted,Endline)
for i,v in Use do
UseFunction(v)
if return == 1 then
return 3 = 4
end
end
end

now for tabbing look how messy it looks, first tab all the lines that the function looks over

function Main()
	SendToAll("test")
	RestartMain()
	KillFunctions()
	ChecksRestarts()
	UpdateText(Retarted,Endline)
	for i,v in Use do
	UseFunction(v)
	if return == 1 then
	return 3 = 4
end

now there is a for, every for must come to an end

function Main()
	SendToAll("test")
	RestartMain()
	KillFunctions()
	ChecksRestarts()
	UpdateText(Retarted,Endline)
	for i,v in Use do
	UseFunction(v)
	if return == 1 then
	return 3 = 4
end -- if
end -- for
end -- function

now to tab them up more

function Main()
	SendToAll("test")
	RestartMain()
	KillFunctions()
	ChecksRestarts()
	UpdateText(Retarted,Endline)
	for i,v in Use do
		UseFunction(v)
		if return == 1 then
			return 3 = 4
		end -- if
	end -- for
end -- function

now for some ppl this will be confusing at first so re read it sorry i sometimes dont make sense to myself lol but theres a little reminder, that how i used to remind myself lol

l8rr,,
Resistance is futile!

NightLitch

One easy way to is:

To each function there is always an end.
And to every if there is always an end.
And to every for there is always an end.

and if you use:


if
elseif
elseif

it will be just one

end

what do you guys call this "table" call for ?? my english sucks
right now...

accociative or ???
//NL

plop

associative (or something like that, terible word 2 spell).

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

pHaTTy

if you associate something with something i guess yes its

associate lol :)

Damn PLOP NOOOOOOOOOO!!!! :P

that screen i used to see it every 2 minutes on win98 lol
Resistance is futile!

plop

the key is associated with a vallue, thats why some wise ass named it an associative array.
maby a linked array would have been easyer, definatly 2 spell.

good that you like my avatar phatty.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

kepp

#5
I never understood why either, but with a little google search i found out that it's purposes is, to keep up the structure of the code.
and yes, i aslo notice that it became very easy to read it that way aswell..

:D
Guarding    

SMF spam blocked by CleanTalk