I’m not even sure how to phrase this but basically I add origin tags to my function call parameters.
In the example below I create an object from a function named “newObject” in the module “create_objects.lua” and then set it’s color with a setColor( ) function in my “color.lua” module, thus —> color.setColor( ).
I use the “origin” parameter to track the origin of the setColor( ) function - in this case so I know it came from the “objects” module and not the “enemy” module.
[lua]
color.setColor( object1, {color = “red”, origin = “newObject( ) ; create_object.lua”)
[/lua]
I started doing this to help with debugging years ago (a sort of Jerry-rigged stack trace) and now it’s a habit but, hey, there’s got to be a better way. Any Lua gurus want to chime in?