String (API)

From ComputerCraft Wiki
Revision as of 15:44, 19 April 2012 by OminousPenguin (Talk | contribs)

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
"abc=def":gmatch("([^=]*)=?") -- Works (Note: This produces the same result as the above pattern should)
"abcdef":gmatch("[^=]*")  -- Works
"abc=def":gmatch("[^=]*=")  -- Works