[ENH] Arguments passed to Variable Functions
TimothyLuke opened this issue ยท 5 comments
Discussed in #1138
Originally posted by xxauroraxx July 8, 2022
I'd like the ability to be able to pass arguments to functions existing within variables. My current use case is to write repeatable code for use across blocks or sequences.
I'm looking at the implementation and it may have to be something like
~~VARIABLE {param1: "parameter 1", param2:"paramter 2"}~~
and then inside
local function (args)
local param1 = args.param1
.....
end
@xxauroraxx I'm trying to work this through.
Currently this depends on loadstring in Lua. To do this it would need a complete custom markup. Currently GSE uses two '~' to show variable which could be a simple string, int, boolean or the value of a function. IE ~~VARIABLE~~
. Would you be expecting ~~VARIABLE('value1', 'value2')~~
At the moment I am thinking the simplest syntax for users might be:
~~VARIABLE "parameter 1" "paramter 2"~~
Without taking a look at your source code, I'd imagine you could use regexes to parse out values. I have no knowledge of the userbase so I'd defer to your judgement on specifying values for parameters.
This is superseded by #1432. The new Global Variables will have this by default.