lua-users home
lua-l archive

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

What is the preferred way of writing subj. in Lua?

Say, I want to write code that does '#' on value x. I can write:

  while #x do break end
  do local _ = #x end
  (function () return #x end)()

... and so on.

Is there something that has least runtime and size overhead,
i.e. doesn't create extra branches or stack allocations in bytecode?