namespace Lua.Standard.Mathematics; public sealed class LogFunction : LuaFunction { public static readonly LogFunction Instance = new(); public override string Name => "log"; protected override ValueTask InvokeAsyncCore(LuaFunctionExecutionContext context, Memory buffer, CancellationToken cancellationToken) { var arg0 = context.ReadArgument(0); if (context.ArgumentCount == 1) { buffer.Span[0] = Math.Log(arg0); } else { var arg1 = context.ReadArgument(1); buffer.Span[0] = Math.Log(arg0, arg1); } return new(1); } }