github.com/hirochachacha/plua@v0.0.0-20170217012138-c82f520cc725/stdlib/string/testdata/gmatch.lua (about) 1 f = string.gmatch("hello world from Lua", "%a+") 2 assert(f() == "hello") 3 assert(f() == "world") 4 assert(f() == "from") 5 assert(f() == "Lua") 6 7 f = string.gmatch("from=world, to=Lua", "(%w+)=(%w+)") 8 k, v = f() 9 assert(k == "from" and v == "world") 10 k, v = f() 11 assert(k == "to" and v == "Lua")