r/learnpython • u/ItsJustToastie • 3h ago
how do i make an embedded lua interpreter?
im trying to make a project where in some parts you can run actual lua code. how would i make this and what libraries would i need (i already have lupa if that is usefull)
1
Upvotes
1
u/RyanDubois43 2h ago
lupa.LuaRuntime() is what you want, then call.execute() on it to run lua code as a string. Remember that Lua variables and Python variables are not shared directly unless you pass them in.
2
u/lakseol 3h ago
Try searching on "lua in python". That finds things that you might be able to use, like this, amongst others:
https://luascripts.com/lua-in-python