Neopallium / nixio

System, Networking and I/O library for Lua. This is an unoffical fork of NIXO from: http://luci.subsignal.org/
http://neopallium.github.io/nixio/
Apache License 2.0
58 stars 23 forks source link

nixio.bit.check is meant to accept multiple flags but doesn't #9

Closed karlp closed 1 month ago

karlp commented 11 years ago

At least on the documentation at http://luci.subsignal.org/api/nixio/modules/nixio.bit.html#check the check function is meant to check all flag arguments. On both my local fedora installation via luarocks, and my openwrt installation, this is clearly not happening:

root@OpenWrt:~# lua
Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio (double int32)
> nix = require("nixio")
> x = 6
> =nix.bit.check(x, 2)
true
> =nix.bit.check(x,3)
false
> =nix.bit.check(x,2,3)
true
> =nix.bit.check(x,3,2)
false
> 

Only the first flag is checked. This matches up with the source at https://github.com/Neopallium/nixio/blob/master/src/bit.c#L103 which is clearly only checking the first argument.

Now, this clearly works as implemented, but the docs are not right at least.

Neopallium commented 1 month ago

Fix in release 0.4.1: luarocks install Neopallium/nixio

nixio.bit.check will now "bitwise or" all the flags and check that all flags are set.