CC: Tweaked

CC: Tweaked

42M Downloads

String:gmatch weirdness

roger109z opened this issue ยท 4 comments

commented

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

commented

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?

commented

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?

commented

Nothing's changed. The only thing I can imagine is if you typed print(str) instead of print(k).

commented

it's possible yea, I'm pretty dumb sorry