xsharp.eu • Searching for a Solution with "DO &VarName"
Page 1 of 1

Searching for a Solution with "DO &VarName"

Posted: Thu Sep 29, 2022 7:26 am
by Florentin Lüdeking
Hey guys is there a solution for my little problem to start a prg with a variable?

Code: Select all

cExecCode = "programm1"
DO &cExecCode
I also tried evaluate() but it didnt work either.

Searching for a Solution with "DO &VarName"

Posted: Thu Sep 29, 2022 11:23 am
by robert
Florentin,

The compiler rule for DO expects an identifier and not a macro (yet). I will change that for a next build.

You should be able to call it like a function:

Code: Select all

&(cExecCode+"()")
or slightly more advanced, bypassing the macro compiler

Code: Select all

_CallClipFunc(cExecCode)
The last method also allows you to pass parameters like this

Code: Select all

_CallClipFunc(cExecCode,1,"42",Date())
Robert

Searching for a Solution with "DO &VarName"

Posted: Thu Sep 29, 2022 11:28 am
by robert
Florentin,
Added as "todo"
https://github.com/X-Sharp/XSharpPublic/issues/1147
Robert

Searching for a Solution with "DO &VarName"

Posted: Thu Sep 29, 2022 12:11 pm
by Florentin Lüdeking
I tried the solution and it works :)

Thank your Robert!