[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Does lua optimize the collection of "anonymous" tables?
- From: Andrew Starks <andrew.starks@...>
- Date: Sun, 17 Nov 2013 21:47:47 -0600
Example:
for i, v in pairs(args.optional_table or {}) do
--stuff
end
If the "or {}" is triggered, is it gc'd in the same way as all other
garbage, or is there some kind of optimization that makes this
different?
Second example:
local function my_func(args)
local first, second = args.arg1, args.arg2
print(first, second)
end
my_func{arg1 = "hello", arg2 = "world"}
Again, the anonymous table is assigned to args, but args is never
assigned and it's never passed as an argument to something else.
Is it treated differently in collection or is "garbage garbage."?