[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: help wanted with table.insert, table.remove, and metatables
- From: Norman Ramsey <nr@...>
- Date: Tue, 20 Nov 2007 18:16:37 -0500
> Why exactly don't you like replacing table.insert et.al?
It starts to sound like lots of chances for me to make mistakes,
chances for me to overlook functions I should have replaced but
didn't, plus I don't know how to replace #. The approach just feels
awfully heavyweight for value received---a little bit un-Lua-like :-)
Norman
> You can
> still use the original ones, somewhat like this:
>
> local table_insert= table.insert
>
> table.insert= function( ... ) -- ( table, [pos,] value )
> ... your code here ...
>
> table_insert(...)
> end
Or even better,
do
local insert = table.insert
table.insert = function(...) ... end
end
But still quite heavyweight in the end.
Norman