I am new to lua and encountered the following piece of code
function X()
local function Y() ... end
local var1 = {var2=Y}
...
return blah
end
What does local var1 = {var2=Y}
do/mean here?
Thanks!
I am new to lua and encountered the following piece of code
function X()
local function Y() ... end
local var1 = {var2=Y}
...
return blah
end
What does local var1 = {var2=Y}
do/mean here?
Thanks!
Jumped the gun on this one. Seems like it simply declares an associative array (
table
) with key as "var2" and value as Y. Equivalent to the following:More details here: How to quickly initialise an associative table in Lua?