lua-users home
lua-l archive

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


> i would add support for binary and octal integer literals like
> 0b1001011 or 0o0755 as in Python and Ruby.
> 
> octal integer literals are helpful when working with unix (file)
> modes/permissions (which i do frequently).

  function Oo(x) return tonumber(x, 8) end
  function Ob(x) return tonumber(x, 2) end

  print(Ob"1001011")              --> 75
  print(Oo"0755")                 --> 493

:-)

-- Roberto