Recreation of the Lua virtual machine

LuaFAR 3

Recreation of the Lua virtual machine


It is possible to “recreate” the Lua virtual machine (lua_State), used by the plugin, i.e: to close the current one and create a new one.

  • In order to do that the global variable RecreateLuaState should be assigned a true value.
  • The analysis of RecreateLuaState and the virtual machine recreation are conducted in the OpenW plugin’s exported function, just before returning control to Far Manager.
  • Prior to the virtual machine recreation the LF_ExitFAR function is called.
  • After the virtual machine is recreated all actions that normally occur when Far Manager loads a LuaFAR plugin are conducted, including running the plugin’s “starting” Lua script (which in this case receives true as an argument).
  • After the virtual machine is recreated the global variable IsLuaStateRecreated is set to true.