static WrenForeignMethodFn BindForeignMethod(WrenVM VM, string Module, string ClassName, bool Static, string Sig) { if (ClassName == "DotNet" && Static) { if (Sig == "SomeFunction()") return SomeFunction; } return null; }
public static extern void ReturnString(this WrenVM VM, string Txt = "", int Len = -1);
public static extern void ReturnDouble(this WrenVM VM, double Val = 0.0);
public static extern void ReturnBool(this WrenVM VM, bool Val = false);
public static extern string GetArgumentString(this WrenVM VM, int Idx);
public static extern double GetArgumentDouble(this WrenVM VM, int Idx);
public static extern bool GetArgumentBool(this WrenVM VM, int Idx);
public static extern void ReleaseMethod(this WrenVM VM, IntPtr Method);
public static extern void Call(this WrenVM VM, IntPtr Method, string Types, __arglist);
public static extern IntPtr GetMethod(this WrenVM VM, string Module, string Variable, string Signature);
public static extern WrenInterpretResult Interpret(this WrenVM VM, string SrcPath, string Src);
public static extern void FreeVM(this WrenVM VM);
static string LoadModule(WrenVM VM, string Module) { if (File.Exists(Module)) return File.ReadAllText(Module); return ""; }
static void SomeFunction(WrenVM VM) { VM.ReturnString("Hello Wren World #" + Rand.Next(1, 100) + "!"); }