samyeyo / rtc

Lua script to executable compiler
https://www.luart.org
MIT License
60 stars 4 forks source link

Compiled .exe is changing execution behaviour when .lua source files are changed, without recompilation. #6

Open null-circle opened 4 months ago

null-circle commented 4 months ago

I created a .exe using "rtc -s main.lua ." (static compilation, integrating the source files in the current directory into the .exe) resulting in main.exe. If the .lua source files in the directory are changed, the execution of main.exe changes to match the changes in the source files without recompiling the .exe. If main.exe is moved into a different folder (so it is not in the same folder as the .lua source files) the execution behaviour reverts to the behaviour matching the source files at the time it was compiled.

samyeyo commented 4 months ago

It's not really a bug, as LuaRT module search starts first with package.path and package.cpath values.

If not found, the module is then searched in the executable embedded content.

Maybe I will modify this to search first for modules bundled with the executable.