If someone didn't understand, the bug is on the error message, and if it happens with this code, maybe can happen with other too, in situations that aren't clear
For a more minimal example, running just this code by itself:
for p,i in pairs("ssss") do print(i) end |
results in this message
in pairs line 0 (tab 0) at line 1 (tab 0) |
I got curious and checked if all()
has similar behavior. Replacing pairs()
with all()
and supplying only 1 variable results in printing the characters one after another and then printing a blank string endlessly.
Also checked count()
inside print()
to see what occurs. It returns without printing anything.
Lastly, foreach()
used with a string and print
as the function results in the same behavior as using all
.
I didn't checked all that things, but I tested with all() and got everything alright. I think I broke the loop before it happens. Thanks for test everything, found a error in the code.
@biteco8, please change the TOPIC away from "bugs" to "chat" or something else if you are satisfied with the solution - so ZEP won't be seeing and trying to correct this problem as it is listed such.
Thanks !
No, I found a specfic problem in my code, the error mensages are still buggy. The problem isn't in my code, is on the error log. See the first image.
Realistically, @biteco8, you'd want to be using ipairs("...")
, not pairs("...")
, since a string is an ordered sequence that's keyed purely by integers. Though, sadly, that doesn't work either.
That being said, I did just make a post to suggest to @zep that he return nil
for out-of-bounds string accesses, because I think that would make the almost-working all("...")
iterator that @kimiyoribaka discovered work.
[Please log in to post a comment]