|
|
||
|
On Feb 1, 2008, at 11:31 PM, Eric Tetz wrote:
LUA = JSON
:gsub('([^\\])\\"', '%1\3')
:gsub('"[^"]*"', function(s)
return s:gsub('[%[%]]', {['[']='\1', [']']='\2'}) end)
:gsub('[%[%]]', {['[']='{', [']']='}'})
:gsub('("[^"]*")%s*:', '[ %1 ] =')
:gsub('[\1\2\3]', {['\1']='[', ['\2']=']', ['\3']='\\"'})
Cool :) Here is a take from the ruby people: http://groups.google.com/group/comp.lang.ruby/msg/c7e90caa0cfd8aa2