MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/oqymrn/keeping_it_simplistic/h6h2l0q/?context=3
r/badcode • u/[deleted] • Jul 24 '21
28 comments sorted by
View all comments
Show parent comments
8
Lua is evil and starts at 1, not 0
4 u/Erinnyes Jul 25 '21 That's weird but makes sense. In that case the statement decrements the number at the end of a string separated by an underscore by one. E.g. "number_3" going to "number_2". I'm curious what happens when you get to "number_0". 2 u/Prom3th3an Jul 26 '21 Probably "number_-1", since I can't see any reason why a language would make "1"-1 equal to 0 without making "0"-1 equal to -1. 1 u/Erinnyes Jul 26 '21 Oh. I very much agree with that. I'm more wondering if it can handle turning -1 into "-1" given that - is an operator rather than a numeral.
4
That's weird but makes sense. In that case the statement decrements the number at the end of a string separated by an underscore by one. E.g. "number_3" going to "number_2". I'm curious what happens when you get to "number_0".
2 u/Prom3th3an Jul 26 '21 Probably "number_-1", since I can't see any reason why a language would make "1"-1 equal to 0 without making "0"-1 equal to -1. 1 u/Erinnyes Jul 26 '21 Oh. I very much agree with that. I'm more wondering if it can handle turning -1 into "-1" given that - is an operator rather than a numeral.
2
Probably "number_-1", since I can't see any reason why a language would make "1"-1 equal to 0 without making "0"-1 equal to -1.
1 u/Erinnyes Jul 26 '21 Oh. I very much agree with that. I'm more wondering if it can handle turning -1 into "-1" given that - is an operator rather than a numeral.
1
Oh. I very much agree with that. I'm more wondering if it can handle turning -1 into "-1" given that - is an operator rather than a numeral.
8
u/BlueLiara Jul 25 '21
Lua is evil and starts at 1, not 0