So if I understand this correctly, Lua data types of string, numbers are values, while functions and tables are references. Does this mean that if I do:
local x = 5
local y = x
Is the variable y, a copy of x and is not a reference, which means doing it this way will consume twice the memory?
While doing:
local myTab = { one = "hello" }
local myTab2 = myTab
Would mean that myTab and myTab2 reference the same table and assigning myTab to myTab2 won’t consume extra memory?
I ask this since I usually tend to reassign global variables to local variables to improve speed.
Such as:
Config = {} -- This is in file1.lua
-- On file2. lua we do:
local Config = Config
So this should theoretically improve speed by a bit since we’re assigning it to a local variable, but I wonder if doing so will consume significantly more memory, especially when we’re dealing with larger programs with bigger data.