资 源 简 介
Project moved to github.
slpp is simple lua-python data structures parser.
Lua data check:
data = "{ array = { 65, 23, 5 }, dict = { string = "value", array = { 3, 6, 4}, mixed = { 43, 54.3, false, string = "value", 9 } } }"> data = assert(loadstring("return " .. data))()> for i,j in pairs(data["dict"]) do print(i,j) endmixed table: 0x880caf0string valuearray table: 0x880caa0
Parse lua data:
>>> from slpp import SLPP>>> lua = SLPP()>>> data = lua.decode("{ array = { 65, 23, 5 }, dict = { string = "value", array = { 3, 6, 4}, mixed = { 43, 54.3, false, string = "value", 9 } } }")>>> print data{"array": [65, 23, 5], "dict": {"mixed": {0: 43, 1: 54.33, 2: False, 4: 9, "string": "value"}, "array": [3, 6, 4], "string": "value"}}
Dump python object:
>>> lua.encode(data)"{array = {65,23,5,},d