lua-users home
lua-l archive

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


Title: Bit-wise operation in Lua?

Hi,

I'm using Lua in embedded and want to check on single bits in a variable. How do I accomplish this?

In C I would do like this:

if ( my_var & 0x1000 )
{
        do_something();
}


Best regards / Med venlig hilsen
Johannes Hessellund Hansen
Software Engineer Trainee
Danfoss Drives
Motion Controls Division
Office DG-1204, Graasten, Denmark
Tel.: +45 7488 4530
Email to: johannes@danfoss.com

Web:
http://www.danfoss.com/