Finalsolo963@lemmy.blahaj.zone to 196@lemmy.blahaj.zoneEnglish · 2 years agoLua rulelemmy.blahaj.zoneimagemessage-square7fedilinkarrow-up1129arrow-down11file-text
arrow-up1128arrow-down1imageLua rulelemmy.blahaj.zoneFinalsolo963@lemmy.blahaj.zone to 196@lemmy.blahaj.zoneEnglish · 2 years agomessage-square7fedilinkfile-text
minus-squarelugal@lemmy.mllinkfedilinkarrow-up8·2 years agoWhy does it go to 19 and not 20? You’re saving on the wrong end!
minus-squareKerb@discuss.tchncs.delinkfedilinkarrow-up26·edit-22 years agothats probably taking the piss with how lua handles array indexing. in most programming languages, the first element of an array is element 0, in lua arrays start with element 1. imo it kinda makes sense, but it causes confusion because it goes against established conventions
minus-squarelugal@lemmy.mllinkfedilinkarrow-up2·2 years agoI never worked with lua but I get it now. Thanks!
minus-squareAdrianTheFrog@lemmy.worldlinkfedilinkEnglisharrow-up2·2 years agoScratch and Mathematica also have arrays start at one.
Why does it go to 19 and not 20? You’re saving on the wrong end!
thats probably taking the piss with how lua handles array indexing.
in most programming languages,
the first element of an array is element 0,
in lua arrays start with element 1.
imo it kinda makes sense,
but it causes confusion because it goes against established conventions
I never worked with lua but I get it now. Thanks!
Scratch and Mathematica also have arrays start at one.