Browse Source

Revert "Fix: string.len (str.Length -> UTF-8 Byte Count)"

This reverts commit 644eebbe8dd64c6a4084fe9c2d17d1fbd5087edb.
AnnulusGames 1 year ago
parent
commit
63758967ca
1 changed files with 1 additions and 3 deletions
  1. 1 3
      src/Lua/Standard/Text/LenFunction.cs

+ 1 - 3
src/Lua/Standard/Text/LenFunction.cs

@@ -1,6 +1,4 @@
 
-using System.Text;
-
 namespace Lua.Standard.Text;
 
 public sealed class LenFunction : LuaFunction
@@ -11,7 +9,7 @@ public sealed class LenFunction : LuaFunction
     protected override ValueTask<int> InvokeAsyncCore(LuaFunctionExecutionContext context, Memory<LuaValue> buffer, CancellationToken cancellationToken)
     {
         var s = context.GetArgument<string>(0);
-        buffer.Span[0] = Encoding.UTF8.GetByteCount(s);
+        buffer.Span[0] = s.Length;
         return new(1);
     }
 }