Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement a table-like shortcut to rpm macros in Lua
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.
- Loading branch information
Showing
2 changed files
with
146 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters