[Rpm-maint] [rpm-software-management/rpm] Add shorthand macros for some conventient Lua string operations (PR #2181)

Panu Matilainen notifications at github.com
Mon Sep 12 09:43:42 UTC 2022


@pmatilai commented on this pull request.



> @@ -1096,6 +1096,22 @@ static void doLua(MacroBuf mb,  rpmMacroEntry me, ARGV_t argv, size_t *parsed)
     }
 }
 
+/*
+ * Wrap a call to Lua string functions.
+ * Note extra parentheses to force only one result returned, multi-value
+ * returns such as from string.gsub() make no sense in this context.
+ */
+static void doString(MacroBuf mb, rpmMacroEntry me, ARGV_t argv, size_t *parsed)
+{
+    char *arg = argvJoin(argv+1, "', '");
+    char *s = rstrscat(NULL,
+		"return (string.", argv[0], "('", arg, "'))", NULL);

And yeah, that works, thanks for the suggestion.

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

Message ID: <rpm-software-management/rpm/pull/2181/review/1103788988 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20220912/25f9ab83/attachment.html>


More information about the Rpm-maint mailing list