[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: new thought experiment: what would you add to Lua ?
- From: Roberto Ierusalimschy <roberto@...>
- Date: Fri, 14 Sep 2018 17:22:31 -0300
> 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