GSE: Sequences, Variables, Macros

GSE: Sequences, Variables, Macros

6M Downloads

[ENH] Arguments passed to Variable Functions

TimothyLuke opened this issue ยท 5 comments

commented

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.

commented

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
commented

I'd personally be happy with that implementation

commented

@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')~~

commented

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.

commented

This is superseded by #1432. The new Global Variables will have this by default.