lua-users home
lua-l archive

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


 > 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