lua-users home
lua-l archive

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


> a[#a+1]=item
> and not
> table.insert(a,item)

Way! I didn't know that, I use table.insert(a, item) everwhere, how
much is the difference?

> 2. (this is more on the "someone tell me the rationale" side)
> I was really puzzled that no library copy operation existed (ie.
> table.copy).
> After all the only data structure in Lua are tables, and making shallow or
> deep copies of them is not something one should consider an infrequent
> operation. Only after a while I began to understand the minimalistic
> "philosophy" of Lua.

Not in favor of deep copy, but I suppose a C implementation that
copies the whole hashtable should way effectiver than
for k, v in pairs(table) do
   newtable[k] = v
end
shouldn't it?

And I do this occassionaly, but maybe you just proven me, that I'm not
actually using the effectivst things?