summaryrefslogtreecommitdiff
path: root/src/lua_runtime.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua_runtime.zig')
-rw-r--r--src/lua_runtime.zig10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lua_runtime.zig b/src/lua_runtime.zig
index 73078c0..c15ee63 100644
--- a/src/lua_runtime.zig
+++ b/src/lua_runtime.zig
@@ -549,7 +549,7 @@ const Slot = struct {
/// via the `pcall` wrapping.
ok: bool = false,
/// Result payload as owned parts. Allocated from `allocator`.
- /// Caller frees via `panto.freeResultParts`.
+ /// Caller frees via `panto.ResultParts.deinit`.
value: ?[]panto.ResultPart = null,
/// On `ok = false`, an owned copy of the error message.
err_msg: ?[]u8 = null,
@@ -703,11 +703,11 @@ fn runBatch(
continue;
}
if (slot.ok) {
- results[i] = .{ .ok = slot.value orelse try panto.textResult(allocator, "") };
+ results[i] = .{ .ok = slot.value orelse (try panto.ResultParts.fromText(allocator, "")).items };
// Free the err_msg if both ended up set somehow.
if (slot.err_msg) |m| allocator.free(m);
} else {
- if (slot.value) |v| panto.freeResultParts(allocator, v);
+ if (slot.value) |v| (panto.ResultParts{ .items = v }).deinit(allocator);
std.log.warn(
"panto-lua: tool '{s}' failed: {s}",
.{
@@ -740,7 +740,7 @@ fn formatToolError(
"panto-lua: tool '{s}' failed: {s}",
.{ tool_name, message },
);
- return panto.ownedTextResult(allocator, text);
+ return (try panto.ResultParts.fromTextOwned(allocator, text)).items;
}
/// Start one coroutine: create a thread under the runtime's lua_State,
@@ -1077,7 +1077,7 @@ fn okText(result: panto.ToolCallResult) []const u8 {
/// Test helper: free a results slice (parts on `.ok`).
fn freeResults(results: []panto.ToolCallResult) void {
for (results) |r| switch (r) {
- .ok => |b| panto.freeResultParts(testing.allocator, b),
+ .ok => |b| (panto.ResultParts{ .items = b }).deinit(testing.allocator),
.err => {},
};
}