summaryrefslogtreecommitdiff
path: root/src/zisp/value/array.zig
diff options
context:
space:
mode:
authorTaylan Kammer <taylan.kammer@gmail.com>2026-06-20 22:53:50 +0200
committerTaylan Kammer <taylan.kammer@gmail.com>2026-06-20 22:53:50 +0200
commitb84ed4f563b3536365f7d3cc4d068407e98685b3 (patch)
tree9ab7b18d712db1329b6230cb45520e7c85dc46fd /src/zisp/value/array.zig
parentbfaa74b19fc81dbe071d55566a78a8e329237eff (diff)
It's a revolution baby.
Diffstat (limited to 'src/zisp/value/array.zig')
-rw-r--r--src/zisp/value/array.zig8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/zisp/value/array.zig b/src/zisp/value/array.zig
index ad04ce2..5d326a1 100644
--- a/src/zisp/value/array.zig
+++ b/src/zisp/value/array.zig
@@ -140,7 +140,7 @@ pub const ArrayHeader = packed struct(u64) {
}
}
- pub fn str(self: *Self) []const u8 {
+ pub fn bytes(self: *Self) []u8 {
if (self.is_slice) {
const buf = self.bufU8();
const start, const end = self.sliceInfo();
@@ -149,11 +149,15 @@ pub const ArrayHeader = packed struct(u64) {
var arr = self;
if (self.is_ptr) {
arr = self.arrPointer() orelse {
- @panic("Called str() on array with direct buffer pointer.");
+ @panic("Called bytes() on array with direct buffer pointer.");
};
}
return arr.bufContent()[0..arr.size()];
}
+
+ pub fn bytesRO(self: *Self) []const u8 {
+ return self.bytes();
+ }
};
const ArrayType = enum(u2) { int, flt, val, str };