|
On 05/06/2014 07:31 AM, Coroutines wrote:
You would use the metatable as default and the byte index as fall-back? I would find that extremely unpredictable and counter-intuitive. It is quite the opposite of anything in standard Lua.On Mon, May 5, 2014 at 10:14 PM, Thomas Jericke <tjericke@indel.ch> wrote:It would only be a problem for user defined metatables for string that define numerical index, with a different meaning.I think I would amend how I originally wrote the __index: debug.getmetatable('').__index = function (s, k) return string[k] or string.byte(s, k, k) end
-- Thomas