Let me give some examples. Maybe it's the whole list, or even a superset. Feel free to say, "I never use that" or "I never use that and I can't see why anybody would". Or say "using a library function for that would be just as verbose as inlining it." Don't feel free to say,"that's trivial". The more trivial something is, the more likely we agree on how it works. I am so tired of writing/pasting these trivial functions, and looking for what they're called in other people's code.
When looking through your list, I often find that I use something like it — but seldom exactly the same. I've sampled one case below.
You can skip the rest of this post if you like, since I'm not soliciting constructive criticism of my conventions. My point is only that the fact that you do it your way and I do it my way is an argument in favour of not enshrining either in a `standard` library.
Dirk
Shallow-copy a table. I'd use a shallow merge-copy too.
I use this more versatile function. Shallow-copy has `{}` and shallow-merge has
the destination table as third argument.
function util.import(from,items,to)
-- import(from,nil,to) copies everything; can be used as shallow table copy
-- import(from,items,_ENV) copies items to current environment
-- import(from,items) copies items to global environment
-- import(from) copies everything to global environment
-- import(from,foo) replaces foo by a new table if foo is not a table
-- import("name") copies from require "name"
-- if `items` has only one item, it need not be put into a table
-- all versions return the table `to`
to = to or _G or getfenv() -- specified or Lua 5.2 or Lua 5.1
-- FAQ: Why make _G the default, not _ENV?
-- Ans: Otherwise in interactive mode nothing happens past the current line.