Page 2 of 2

Re: Lua "tutorial" guide..blob thing?

Posted: 08 Nov 2014, 02:15
by gajop
In Lua, you don't need to use () in if/for statements, example:

Code: Select all

if (f%10 == 0) then
can be written as

Code: Select all

if f%10 == 0 then

Re: Lua "tutorial" guide..blob thing?

Posted: 08 Nov 2014, 02:38
by zwzsg
FLOZi wrote:Maps should exclusively use LuaGaia

Of course you do, LuaGaia is a separate lua environment - which is why maps should use it exclusively. Just because other maps / older maps don;t doesn't mean people should continue to.
The problem is that, last time I checked, LuaGaia was severly limited compared to LuaRules. Has it been changed?

Re: Lua "tutorial" guide..blob thing?

Posted: 08 Nov 2014, 02:39
by knorke
gajop: I know. ;)
Imo it is personal preference and not so important.
Often I do the if ( ) because imo it helps recognizes conditions faster when scrolling.
When it is just check for nil or similiar,

Code: Select all

if isReady then
or

Code: Select all

if label ~= "" then
then I tend to leave the ( ) out.

:arrow: Imo focus is not on Lua but on "Spring Lua".
Teaching Lua itself is out of scope for such texts and such stylistic details even more so. ;) I will try to maintain some constant style but imo just not so important here.
Except I will try to write in "easy and elaborate" so no "tricks" like

Code: Select all

bla = blub or blop
Imo the f%10 is already bit "tricky" for such basic level tutorial but it is some commonly used in spring...

Re: Lua "tutorial" guide..blob thing?

Posted: 08 Nov 2014, 21:02
by PicassoCT
knorke wrote: Imo the f%10 is already bit "tricky" for such basic level tutorial but it is some commonly used in spring...

some use speakingNamed functions for tutorials even though they are not as effective

Code: Select all

function everyTenthFrame(frames)
if f%10==0 then return true else return false end

end

...
if everyTenthFrame(frames)== true then
--do stuff
end

Re: Lua "tutorial" guide..blob thing?

Posted: 08 Nov 2014, 22:50
by FLOZi
Modulo is quite a common enough concept early on in basic programming imo

Re: Lua "tutorial" guide..blob thing?

Posted: 08 Nov 2014, 23:18
by PicassoCT
and the percentage of humanity on the internet who has a clue of basic programming and remember that after all those years is exactly one FLOZillionst part of humanity...

Re: Lua "tutorial" guide..blob thing?

Posted: 08 Nov 2014, 23:52
by MetalSucker
FLOZi wrote:Modulo is quite a common enough concept early on in basic programming imo
+1

I also want to add .. it could be better without that gradient on the code snippets and maybe syntax highlighting. (don't hit me).

Re: Lua "tutorial" guide..blob thing?

Posted: 09 Nov 2014, 09:22
by knorke
gradient in color or difficulty? about look of wiki can not do much. syntax highlighting might come if wiki gets updated , would be nice. Think for oneliners/short pieces one can do without and ideally the reader has whole script in own editor anyway...

Re: Lua "tutorial" guide..blob thing?

Posted: 09 Nov 2014, 10:24
by FLOZi
I'll keep asking abma to update the wiki software, maybe now after the server switch it is more likely.