[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua.NET : How to use hexa decimal numbers
- From: Eike Decker <eike@...>
- Date: Fri, 5 Oct 2007 11:51:01 +0200
It's a bit inconvenient, but as a workaround, you could also write a function
that converts a string hexcode (in lua5.1 tonumber does it as well) into a
decimal:
function hex (str) return tonumber (str) end -- 5.0 compatible?
-- otherwise, write a function to convert the string
print(hex'0xff') -- 255
Eike
> You need Lua 5.1.
>
> On 10/5/07, Lythoner <lythoner@gmail.com> wrote:
> > It is not working for Lua.NET. Here is the error message I get.
> >
> > C:\>lua50
> > Lua 5.0.2 Copyright (C) 1994-2004 Tecgraf, PUC-Rio
> > > = 0x1234
> > stdin:1: <eof> expected near `x1234'
> > >
> >
> > Regards,
> >
> > Lythoner
> >
> > Asko Kauppi wrote:
> > >
> > > Lua 5.1.2 Copyright (C) 1994-2007 Lua.org, PUC-Rio
> > > > = 0x12345678
> > > 305419896
> > >
> > > I don't know about Lua.NET though; the behaviour actually comes from a
> > > C library function, but is documented for Lua.
> > >
> > > Do you need 32-bit or 64-bit figures?
> > >
> > >
> > > Lythoner kirjoitti 5.10.2007 kello 8:31:
> > >
> > >> Hi All,
> > >>
> > >> We use Lua as a configuration as well as do some programming with it.
> > >> Our configuration can consists of tens of thousands lines and derived
> > >> from an C interface.
> > >>
> > >> We use Hexa decimal constants heavily in our C interface and also the
> > >> same Hex code has been used in specification too.
> > >>
> > >> Now how to use the HEX constants in Lua.NET?
> > >>
> > >> Regards,
> > >>
> > >> Lythoner
> > >
> > >
> >
> >
>