[Rpm-maint] [rpm-software-management/rpm] Add shorthand macros for some conventient Lua string operations (PR #2181)
Michael Schroeder
notifications at github.com
Mon Sep 12 08:49:26 UTC 2022
@mlschroe 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);
How about using `"return (string.", argv[0], "(table.unpack(arg)))"`? You need to directly call rpmluaRunScript(), of course.
--
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2181#discussion_r968149063
You are receiving this because you are subscribed to this thread.
Message ID: <rpm-software-management/rpm/pull/2181/review/1103710953 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20220912/5c981a82/attachment.html>
More information about the Rpm-maint
mailing list