Skip to content

Iterating Modulators w/ panel:getModulatorByIndex(i): Any Benefits of Dedicated Vars vs Lookup Hashtable? #620

Closed Answered by dnaldoog
unityconstruct asked this question in Q&A
Discussion options

You must be logged in to vote

If you create a lua table with keys with values pointing to an object like panel:getModulator() or panel:getComponent() then I am pretty sure those are references and won't change during runtime.

I use metatables to achieve this. This way you don't end up with a slew of variable names in the global space _G. I wrote this before goodweather pointed out that you can run lua functions from the console (I never knew that until recently) thus updating an init script that might contain lua variables for modulators ― but even so it's a convenient way to write code and you can use any variable name using lua's [""] table key syntax.

There is probably a performance hit when a variable pointing to …

Replies: 5 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@unityconstruct
Comment options

Answer selected by unityconstruct
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants