Finalsolo963@lemmy.blahaj.zone to 196@lemmy.blahaj.zoneEnglish · 1 year agoLua rulelemmy.blahaj.zoneimagemessage-square7fedilinkarrow-up1128arrow-down11file-text
arrow-up1127arrow-down1imageLua rulelemmy.blahaj.zoneFinalsolo963@lemmy.blahaj.zone to 196@lemmy.blahaj.zoneEnglish · 1 year agomessage-square7fedilinkfile-text
minus-squarelugal@lemmy.mllinkfedilinkarrow-up8·1 year agoWhy does it go to 19 and not 20? You’re saving on the wrong end!
minus-squareKerb@discuss.tchncs.delinkfedilinkarrow-up26·edit-21 year 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·1 year agoI never worked with lua but I get it now. Thanks!
minus-squareAdrianTheFrog@lemmy.worldlinkfedilinkEnglisharrow-up2·1 year 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.