DukContext.setGlobal

Set a previously registered symbol as global.

class DukContext
setGlobal
(
string name
)

Examples

1 static int add(int a, int b) {
2     return a + b;
3 }
4 
5 auto ctx = new DukContext();
6 ctx.registerGlobal!add;
7 
8 auto res = ctx.evalString!int("add(1, 5)");
9 assert(res == 6);

Meta