String:gmatch weirdness
roger109z opened this issue ยท 4 comments
When I run
str = "hi_my_name"
for k in str:gmatch("[^_]+") do print(k) end
In the lua program it prints
hi_my_name
hi_my_name
hi_my_name
But if run as an actual program it prints
hi
my
name
I'm unable to reproduce: it prints the latter in all environments I've tried (Lua 5.1-3, CC's Lua REPL and through a CC program). Can you post a screenshot or something, so I can confirm I'm running this correctly?
strangely enough it's not happening anymore. sorry to waste your time. I swear yesterday with the same code on the same computer it was doing weird things and now it's not. maybe there is some difference between the build yesterday and the build today?
Nothing's changed. The only thing I can imagine is if you typed print(str)
instead of print(k)
.