lua-users home
lua-l archive

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


On 16-09-15 02:26 AM, Igor Ehrlich wrote:
> local max_idx = table_maxkey({1,2,8}) -- should return '8'

IMO it should return 3 of have another name.

Personally I do not wish to verify any utility functions. For example

local original_pairs = _G.pairs
_G.pairs = function(...)
  print('pairs_called')
  print_stacktrace()
  return original_pairs(...)
end

or even

_G.pairs = _G.error

And what are you going to do in these cases, refuse to execute? Then
that malicious user will blame your code anyway because it still does
not work.