namespace Lua.Standard.Bitwise; public sealed class BxorFunction : LuaFunction { public override string Name => "bxor"; public static readonly BxorFunction Instance = new(); protected override ValueTask InvokeAsyncCore(LuaFunctionExecutionContext context, Memory buffer, CancellationToken cancellationToken) { if (context.ArgumentCount == 0) { buffer.Span[0] = uint.MaxValue; return new(1); } var value = Bit32Helper.ToUInt32(context.GetArgument(0)); for (int i = 1; i < context.ArgumentCount; i++) { var v = Bit32Helper.ToUInt32(context.GetArgument(i)); value ^= v; } buffer.Span[0] = value; return new(1); } }