On Sunday, 11 December 2016 at 22:18:02 UTC, Adam D. Ruppe wrote:
On Sunday, 11 December 2016 at 22:00:27 UTC, Kevin Balbas wrote:
Basically, I need some way to turn an array of strings
into an argument list at runtime. Is this possible?
Write (or generate) a helper function that loops over t
import std.traits;
import std.stdio;
alias FDg = void delegate (string args);
FDg[string] cmdlist;
void register(DG) (string name, DG dg) if (isCallable!DG) {
cmdlist[name] = delegate (string args) {
import std.array : split;
import std.conv : to;
alias Args = Parameters!DG;
On Sunday, 11 December 2016 at 22:00:27 UTC, Kevin Balbas wrote:
Basically, I need some way to turn an array of strings
into an argument list at runtime. Is this possible?
Write (or generate) a helper function that loops over the
Parameters!Func tuple and populates it from the strings. Call t
I'm writing a system to register functions to be called at
runtime. With zero-argument functions, it works fine. However,
I run into a problem with functions that take arguments.
This is the relevant code I started with (zero-argument version):
mixin template CommandSystemRegister(string s =