I have a Lua expression, which can print some string. For example: print(1+2)
. Then, I call this expression in Python 3 using Lupa library:
import lupa
lua = lupa.LuaRuntime(unpack_returned_tuples=True)
res = lua.eval('print(1+2)')
Of course, res
is None
because this expression returns nothing. But I need to catch the output and save in the variable.
Is this possible? How can I do this?