I'm trying to make like a small interpreter from some scripting language to C# and I need to execute a C# method which is written in a string variable and I want to execute that. Is that possible? And if yes... how exactly can I do this?
My functions function on the end will look something like this:
public IEnumerator Blink()
{
TurnOnLed(true);
yield return new WaitForSeconds(2);
for (var i = 0; i < 10; ++i)
{
TurnOnLed(false);
yield return new WaitForSeconds(1);
TurnOnLed(true);
yield return new WaitForSeconds(1);
}
}
Script code:
output(true)
sleep(2)
for x in range(10)
output(false)
sleep(1)
output(true)
sleep(1)
Where WaitForSeconds is a Unity3D function and TurnOnLed(true) it's mine. when I seach on internet I've fond some solutions where I will create an entire class to be able to run this methon... is any other solution?
Is it there any easy way to do this?