lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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."?