[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:28:23 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);
Heh, quite frankly I didn't even consider quote issue. It's ugly sure, it's the first solution my mind spat out on a Monday morning :laughing:
I was just looking at that table.unpack() stuff but didn't realize it was doLua() getting in the way.
--
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2181#discussion_r968189161
You are receiving this because you are subscribed to this thread.
Message ID: <rpm-software-management/rpm/pull/2181/review/1103767543 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20220912/dee39055/attachment.html>
More information about the Rpm-maint
mailing list