> Bitwise flags would be rpm-native of course, but it doesn't seem very Lua. 
> Bitwise operators were only added to the language in Lua 5.3, so we'd even 
> have to bump our version requirement for that.

Oh, right, I didn't think that far :smile: 

> The closest thing to a "flags" argument in the standard library I could think 
> of is https://www.lua.org/manual/5.4/manual.html#pdf-io.open which uses the 
> string of letters approach. Which should be fine for our purposes, for the 
> time we can just check whether the string equals "c" (for noCheck, avoiding 
> "n" because there are multiple possible no-flags)

Yup, this is what the `fopen()` family of functions uses too, after all, and 
even our own copies like `Fopen()`. It's minimal yet flexible.

> Indeed: https://www.lua.org/manual/5.4/manual.html#luaL_checkoption
> 
> > This is a useful function for mapping strings to C enums. (The usual 
> > convention in Lua libraries is to use strings instead of numbers to select 
> > options.)

Oh OK, that really confirms it then :smile: 


-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2526#issuecomment-1567920071
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/pull/2526/c1567920...@github.com>
_______________________________________________
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint

Reply via email to