[Rpm-maint] [rpm-software-management/rpm] Export rpmGlob() to Lua (PR #2526)

Michal Domonkos notifications at github.com
Tue May 30 07:37:01 UTC 2023


> 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/c1567920071 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20230530/4279c3b0/attachment.html>


More information about the Rpm-maint mailing list