diff options
Diffstat (limited to 'example/src/main.zig')
-rw-r--r-- | example/src/main.zig | 19 |
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! +} |