[QUOTE=Divran;26156974]what's that[/QUOTE]
[url=http://www.inf.puc-rio.br/~roberto/lpeg/lpeg.html]Lua Parsing Expression Grammars[/url]
Deco's (probably broken) module for it:
[url]http://www.facepunch.com/threads/750140[/url]
[editline]19th November 2010[/editline]
[QUOTE=Tobba;26157033]I though lpeg was broken?[/QUOTE]
I use vanilla Lua for testing.
[QUOTE=raBBish;26156919][lua]
local txt = lpeg.C( (1-sep) ^ 1 )
[/lua][/QUOTE]
I suggest you allow zero matches in this to allowing matching for something like "lol this, is, super,,,,,comma-ed", otherwise it'll stop at "super".
[b]Edit:[/b] Mmm... vanilla ice cream.
[QUOTE=Deco Da Man;26157570]I suggest you allow zero matches in this to allowing matching for something like "lol this is super spaced"
Otherwise it'll stop at "super".[/QUOTE]
I had it at zero originally, but it would capture an empty string if the separator was at the end of the string:
"this is a test " = { "this", "is", "a", "test", "" }
[QUOTE=blackops7799;26156082]It's the same exact thing..[/QUOTE]
Actually, str:find(...) should cause less lookups to _G, so in theory should be marginally faster.
You could probably solve that by asserting it doesn't match the end of the string.
( txt-#(0-1) maybe?)
While we're on the topic, here's my LPeg toolkit: [url]http://codepad.org/Td2CtuUp[/url]
[QUOTE=|FlapJack|;26157680]Actually, str:find(...) should cause less lookups to _G, so in theory should be marginally faster.[/QUOTE]
That's what I thought.
[QUOTE=Deco Da Man;26157570][b]Edit:[/b] Mmm... vanilla ice cream.[/QUOTE]
Chocolate ice cream is much better. Speaking of which, I'm gonna go get some right now :) EDIT: With chocolate sauce on top
Sorry, you need to Log In to post a reply to this thread.