Difference between revisions of "String (API)"
From ComputerCraft Wiki
m |
|||
Line 1: | Line 1: | ||
The string API is a default Lua 5.1 API as defined [http://www.lua.org/manual/5.1/manual.html#5.4 here]. Please list any non-working functions below. | The string API is a default Lua 5.1 API as defined [http://www.lua.org/manual/5.1/manual.html#5.4 here]. Please list any non-working functions below. | ||
− | + | ==Non-Working Functions== | |
+ | |||
+ | ===string.gmatch(string, pattern)=== | ||
+ | |||
+ | Using any quantifier other than + will cause it to hang if that quantifier applies to the whole pattern and that pattern does not match the whole string. | ||
+ | |||
+ | Examples: | ||
+ | <pre> | ||
+ | "abcdef":gmatch("%a*") -- Works | ||
+ | "abc=def":gmatch("%a*") -- Hang | ||
+ | "abc=def":gmatch("%a.*") -- Works | ||
+ | "abc=def":gmatch("[%a.]*") -- Hang | ||
+ | "abc=def":gmatch("[^=]*") -- Hang | ||
+ | "abcdef":gmatch("[^=]*") -- Works | ||
+ | "abc=def":gmatch("[^=]*=") -- Works | ||
+ | </pre> | ||
− | |||
[[Category:APIs]] | [[Category:APIs]] |
Revision as of 15:37, 19 April 2012
The string API is a default Lua 5.1 API as defined here. Please list any non-working functions below.
Non-Working Functions
string.gmatch(string, pattern)
Using any quantifier other than + will cause it to hang if that quantifier applies to the whole pattern and that pattern does not match the whole string.
Examples:
"abcdef":gmatch("%a*") -- Works "abc=def":gmatch("%a*") -- Hang "abc=def":gmatch("%a.*") -- Works "abc=def":gmatch("[%a.]*") -- Hang "abc=def":gmatch("[^=]*") -- Hang "abcdef":gmatch("[^=]*") -- Works "abc=def":gmatch("[^=]*=") -- Works