To some extent this is possible with some limitations. I am developing an IDE / debugger that provides this feature. This gives you access to the remote console to execute commands in the context / environment of your running application. The IDE also supports live coding , which reloads the changed code when changes are made to it; see demos here .
The main limitation is that you cannot change the current function (at least without changes in the Lua VM). This means that the effect of your changes on the current work will be displayed only after logging out and re-entering this function. It works well for environments that repeatedly call the same function (for example, the game engine calling draw ), but may not work in your case.
Another problem is with upvalues ββ(values ββcreated outside of your function and referenced within it). There are methods to βreadβ the current values ββof up -ues and recreate them when creating a (new) function, but this requires some code analysis to find which functions will be recreated, request them for upvalues, get the current values, and then create a new one environment with these values ββand assign them the appropriate values. My current implementation does not do this, which means you need to use global variables as a workaround.
There was also relevant discussion only the next day on the Lua mailing list.
source share