News for hackers. Stuff that matters.
Re:Never run ‘python’ in your downloads folder by anonymoushn on Sunday August 23, 2020 @08:37PM (#24256581)
I think you have problems if you just write local foo = require ("foo") in two different files and you want to replace the module object in both of them at once.

Edit: the below is probably wrong about what you're doing. It sounds like your require-replacement merges the new return value of a module into the old one, so code that accesses stuff through the module's top level table will get the right result.

Wrong stuff: Maybe the hot reloading system you use relies on modules mutating the module object rather than making a new one. This is pretty unusual among Lua modules though. I usually see people unconditionally make a table and return it.

Re:Never run ‘python’ in your downloads folder by nonbirithm on Monday August 24, 2020 @02:39PM (#24263878)
Yes, the table merging is what mine actually does. It clears the old table reference and inserts the contents of the new module into it. It seems to work well enough for my use-case.