Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Lua/IO/LuaStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public ValueTask<string> ReadAllAsync(CancellationToken cancellationToken)

public ValueTask WriteAsync(ReadOnlyMemory<char> buffer, CancellationToken cancellationToken)
{
mode.ThrowIfNotWritable();

if (mode.IsAppend())
{
innerStream.Seek(0, SeekOrigin.End);
Expand Down
2 changes: 1 addition & 1 deletion src/Lua/Standard/IOLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public async ValueTask<int> Output(LuaFunctionExecutionContext context, Cancella
}
else
{
var stream = await context.GlobalState.Platform.FileSystem.Open(arg.ToString(), LuaFileOpenMode.WriteUpdate, cancellationToken);
var stream = await context.GlobalState.Platform.FileSystem.Open(arg.ToString(), LuaFileOpenMode.Write, cancellationToken);
FileHandle handle = new(stream);
io["_IO_output"] = new(handle);
return context.Return(new LuaValue(handle));
Expand Down