[Rpm-maint] [rpm-software-management/rpm] Implement a table-like shortcut to rpm macros in Lua (#1419)
Panu Matilainen
notifications at github.com
Fri Oct 30 10:33:20 UTC 2020
Add rpm macro context as a global table-like entity named 'macros' for
a more Lua-native experience with rpm macros.
Support basic indexing syntaxes (macros[k] and macros.k) for access, define
and undefine operations. Undefined macros return nil here and assigning
to nil will undefine (pop) the macro.
As a specialty, parametric macros are returned as native callable
variadic Lua functions. A string argument is passed to expand as is,
but if arguments are passed as a table, eg `r = macros.foo({1, 2, 3})`,
they are passed entirely as-is.
The macro context pointer in the userdata is not consistently used for
all operations here, but then all the macro operations in Lua are hardwired
to the global context anyway so it doesn't matter in practise. Properly
passing the context around in all cases is left for later commits.
GH is not letting me reopen #1398 :unamused: so opening a new one to pick up where we left off there, now that @mlschroe did all the heavy lifting :smile:
You can view, comment on, or merge this pull request online at:
https://github.com/rpm-software-management/rpm/pull/1419
-- Commit Summary --
* Implement a table-like shortcut to rpm macros in Lua
-- File Changes --
M rpmio/rpmlua.c (102)
M tests/rpmmacro.at (44)
-- Patch Links --
https://github.com/rpm-software-management/rpm/pull/1419.patch
https://github.com/rpm-software-management/rpm/pull/1419.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1419
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20201030/8dc1e025/attachment.html>
More information about the Rpm-maint
mailing list