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
LuaValueto a plain Python value.If the value has a
__pymetamethod, 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.
LuaFunctionsare converted using a wrapper function, which converts all arguments intoLuaValues, calls theLuaFunctionusing 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.