[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: [PUZZLE] Appending to a list
- From: Dirk Laurie <dirk.laurie@...>
- Date: Fri, 8 Sep 2017 07:31:24 +0200
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?