String (API)

From ComputerCraft Wiki
Revision as of 15:40, 19 April 2012 by OminousPenguin (Talk | contribs) (string.gmatch(string, pattern))

Jump to: navigation, search

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 - Alternative: "([^=]*)=?"
"abcdef":gmatch("[^=]*")  -- Works
"abc=def":gmatch("[^=]*=")  -- Works