public ScriptFunction(Script scriptRef, DynValue function, LuaFuncType type) { this.ScriptRef = scriptRef; LuaFunc = function; IsCoroutine = !type.HasFlag(LuaFuncType.Function); AutoResetCoroutine = type.HasFlag(LuaFuncType.AutoCoroutine); Coroutine = IsCoroutine ? scriptRef.CreateCoroutine(LuaFunc) : null; FuncType = type; }
public LuaFuncStandard(string path, LuaFuncType type, bool required = true) { Path = path; FuncType = type; Required = required; if (FuncType.HasFlag(LuaFuncType.AllowAny) && (((int)FuncType & 0b0111) < 1)) { throw new ArgumentException("Type must also contain FuncType.Function, FuncType.SingleUseCoroutine, or FuncType.AutoCoroutine", "type"); } if (FuncType.HasFlag(LuaFuncType.AllowAnyCoroutine) && (((int)FuncType & 0b0110) < 1)) { throw new ArgumentException("Type must also contain FuncType.SingleUseCoroutine or FuncType.AutoCoroutine", "type"); } }