Hello there,
I am recently working on my game. I wanted to turn any string to function just loop call. But I don’t know how to implement it.
Do anyone have an idea about it? Please help.
thank.
Hello there,
I am recently working on my game. I wanted to turn any string to function just loop call. But I don’t know how to implement it.
Do anyone have an idea about it? Please help.
thank.
Try this:
let myString = cc.callFunc(() => {
let text = "Sting Value";
this.node.getComponent(cc.Label).string = text;
});
That’s a pure javascript thing:
var newFunc = eval("var retVal = function(){ console.log('Hi there!') }; retVal;");
newFunc();