Skip to content
/ slppu Public
forked from SirAnthony/slpp

Simple lua-python parser (forked to add unicode support in encoding and Python 3 compatiblity)

License

Notifications You must be signed in to change notification settings

noembryo/slppu

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SLPPU

Simple lua-python parser (forked to add unicode and Python 3 support)

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) end
mixed   table: 0x2014290
string  value
array   table: 0x2014200

Parse lua data:

>>> from slppu import slppu as lua
>>> 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},dict = {mixed = {43,54.33,false,9,string = "value"},array = {3,6,4},string = "value"}}'

Dump test:

> data = assert(loadstring('return ' .. '{array = {65,23,5,},dict = {mixed = {43,54.33,false,9,string = "value",},array = {3,6,4,},string = "value",},}'))()
> print(data['dict'])
table: 0x1b64ea0
> for i,j in pairs(data['dict']) do print(i,j) end
mixed   table: 0x880afe0
array   table: 0x880af60
string  value

About

Simple lua-python parser (forked to add unicode support in encoding and Python 3 compatiblity)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%