aboutsummaryrefslogtreecommitdiffstats
path: root/example/src/main.zig
diff options
context:
space:
mode:
authorsadbeast <sadbeast@sadbeast.com>2024-04-15 18:08:28 -0700
committersadbeast <sadbeast@sadbeast.com>2024-05-18 17:23:35 -0700
commita4711cad923d6c7480e596685d9dcaefa241fe3b (patch)
treef0c36edea9b32b8a1825270436868bb020689657 /example/src/main.zig
downloadtmz-a4711cad923d6c7480e596685d9dcaefa241fe3b.tar.gz
tmz-a4711cad923d6c7480e596685d9dcaefa241fe3b.tar.bz2
initial mistakeHEADmain
Diffstat (limited to 'example/src/main.zig')
-rw-r--r--example/src/main.zig19
1 files changed, 19 insertions, 0 deletions
diff --git a/example/src/main.zig b/example/src/main.zig
new file mode 100644
index 0000000..44fa08f
--- /dev/null
+++ b/example/src/main.zig
@@ -0,0 +1,19 @@
+const std = @import("std");
+const tmz = @import("tmz");
+
+pub fn main() !void {
+ var gpa = std.heap.GeneralPurposeAllocator(.{}){};
+ const allocator = gpa.allocator();
+ defer _ = gpa.deinit();
+
+ const parsed_map = try tmz.parseMap(allocator, @embedFile("map.tmj"));
+ defer parsed_map.deinit();
+
+ const stdout_file = std.io.getStdOut().writer();
+ var bw = std.io.bufferedWriter(stdout_file);
+ const stdout = bw.writer();
+
+ try stdout.print("Map: {any}\n", .{parsed_map.value});
+
+ try bw.flush(); // don't forget to flush!
+}