Page 1 of 1

Objects created during "normal" command (ie commands.add_command, not /c) are not "owned" by that mod

Posted: Fri Jun 12, 2020 3:10 pm
by Reika
I noticed it with LuaRendering objects, but there are probably others. If you try and remove objects owned by a given mod, eg rendering.clear(modname), it will not remove ones added by commands that mod owns. It will remove ones spawned by the same code, but with the root caller being some event or something rather than running the command.

Rseding briefly commented on this on the discord:
Console commands run in the scenario lua context.
Why would they be associated with some other mod?
And while that makes sense for "loose" /c commands, it does not for ones added by - and therefore completely owned by - a mod.


This has a really nasty gotcha in it, too: It means that any command designed to "refresh" these objects will work perfectly...once. Upon which time it is never going to work again, as the new ones created are not owned by the mod. I nearly fell for that trap creating exactly that sort of command in my Bioluminescence mod.

Re: Objects created during "normal" command (ie commands.add_command, not /c) are not "owned" by that mod

Posted: Fri Jun 12, 2020 3:48 pm
by Rseding91
Thanks for the report. I fixed this last night shortly after we talked about it in Discord.