Open paulcuth opened 10 years ago
I just ran into the same problem. Here are two examples:
s = "-"
print(string.match(s, "%-"))
output: userdata
(should have been "-")
s = "-2"
print(string.match(s, "%-%d"))
output: 2
(should have been "-2")
The pattern matching seems to be having trouble with the minus sign. The %d seems to work ok.
These pattern matches work fine on my regular Lua.
The following example highlights differences in output of pattern matching functions between C Lua and Moonshine.
C Lua returns:
Moonshine returns:
I believe there's some escaping of special chars missing from the translated pattern prior to construction of the RegExp object.