lua-users home
lua-l archive

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


I used to have the following statement in nearly all of my programs.

    local append = tinsert

where tinsert is a local variable with value table.insert. The idea is
that when the `pos` parameter is omitted, I prefer for the sake of
easy reading to use a different name.

Today, I needed to do this instead:

local append = function(tbl,x) tinsert(tbl,x) end

Why would that be?

Once you have figured it out, the next question is: should I have
expected table.insert to behave that way or is it a deviation from
what the manual says?