[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Reporting possible BUG on string.gsub
- From: Daniel van Ham Colchete <daniel.colchete@...>
- Date: Fri, 23 Jan 2009 11:24:46 -0200
Hello yall,
please take a look at the following code:
----BEGIN---
str = [[This is a string with @@ANYTHING@@ chance of survival]];
replace = "5%"
print(str)
print(replace)
str = str:gsub("@@ANYTHING@@", replace)
print(str)
-----END----
The result I have here is
----BEGIN---
This is a string with @@ANYTHING@@ chance of survival
5%
This is a string with 5
-----END----
But the last sentence should be "This is a string with 5% chance of survival". The problem doesn't happen if the replace string doesn't end with "%". In cases where there is an "%" in the middle (like '5%a') I still have a result different from what I would expect.
I tested it on Lua 5.1.3 and Lua 5.1.4 on Linux. I also tested changing the line replace = "%5" for replace =[[5%]].
GCC version: gcc version 4.1.2 (Gentoo 4.1.2 p1.0.2)
GNU LibC version: 2.6.1
Kernel version: 2.6.26-gentoo-r1
Do I get to have my name on http://www.lua.org/bugs.html??
Best regards,
Daniel