hi all
harrr ! due to help of allanon and andreas and bulaga, soon my first good program (humhum i joke!) will be at a party in two months
actually i have various parts with main fonctions ()
so my idea is to include all this in a main fonction (while renaming others as p_1(), p_2()
are there some rules to respect for ? and have i to include all datas in the main one ?
thanx a lot by advance
regards
make a final fonction ?
Re: make a final fonction ?
ooops not in the main fonction but the include in the main script ?
regards
regards
Re: make a final fonction ?
When you use #INCLUDE. it in practice works same as using copy-paste.
So although part of your code is in different file, you could think it as:
being same as
What comes to your function naming thing, you might have some use from emulating so called "method" approach.
Many c-type languages contain this thing called method. While Hollywood (And LUA, which Hollywood is derivative of) doesnt actually officially have Methods, they can easily be emulated however.
I am mentioning this name "method" just so that you can possib ly google more about it if you want, but I am giving you example what you could do which in practice is method.
AS you should know nby now, Hollywood can have "tables", as example mytable = {1, 2, 3}. But these tables are not restricted to just numbers, but they can also contain strings, even other tables AND... Functions.
Hence we could have for example:
result:
hence, instead of using function naming of p_1, p_2, you could just have p.1, p.2, maybe even p.1.1 if that p_1 has several functions.
And instead of declaring functions the way i did in example, it could also be done:
So although part of your code is in different file, you could think it as:
Code: Select all
#INCLUDE file1
#INCLUDE file 2
rest of the codeCode: Select all
code from file 1
code from file 2
rest of the codeWhat comes to your function naming thing, you might have some use from emulating so called "method" approach.
Many c-type languages contain this thing called method. While Hollywood (And LUA, which Hollywood is derivative of) doesnt actually officially have Methods, they can easily be emulated however.
I am mentioning this name "method" just so that you can possib ly google more about it if you want, but I am giving you example what you could do which in practice is method.
AS you should know nby now, Hollywood can have "tables", as example mytable = {1, 2, 3}. But these tables are not restricted to just numbers, but they can also contain strings, even other tables AND... Functions.
Hence we could have for example:
Code: Select all
Dog = {}
dog.talk = FUNCTION debugprint("wuf!") ENDFUNCTION
dog.sleep = FUNCTION debugprint("zzz...") ENDFUNCTION
dog.talk
dog.sleepCode: Select all
wuf!
zzz...hence, instead of using function naming of p_1, p_2, you could just have p.1, p.2, maybe even p.1.1 if that p_1 has several functions.
And instead of declaring functions the way i did in example, it could also be done:
Code: Select all
function myhelloworldfunction()
debugprint("hello world")
endfunction
dog = {}
dog.talk = myhelloworldfunction()
Re: make a final fonction ?
thank you so much bugala ^^ by the way i didn't forgot to tnak you so much on the scrolling texte 
i go code now, with you cool help and the one of allanon
you rocks !
stéphane
i go code now, with you cool help and the one of allanon
you rocks !
stéphane