Going from Lua to Python

mehtap.lua2py.lua2py(value: LuaNilType) None
mehtap.lua2py.lua2py(value: LuaBool) bool
mehtap.lua2py.lua2py(value: LuaNumber) int | float
mehtap.lua2py.lua2py(value: LuaString) str
mehtap.lua2py.lua2py(value: LuaTable) dict
mehtap.lua2py.lua2py(value: LuaFunction) Callable
mehtap.lua2py.lua2py(value: LuaValue) Any

Convert a LuaValue to a plain Python value.

If the value has a __py metamethod, the converter will call it and convert its return value instead.

Sequence tables are not converted to lists, they are also converted to dicts having keys 1, 2, …, n.

LuaFunctions are converted using a wrapper function, which converts all arguments into LuaValues, calls the LuaFunction using them, and then converts the return value back to a Python value.

This function is implemented using memoization, so it can convert recursive data structures.