{"id":13741460,"url":"https://github.com/dantecatalfamo/wren-zig","last_synced_at":"2025-05-14T11:34:11.038Z","repository":{"id":40430094,"uuid":"479568011","full_name":"dantecatalfamo/wren-zig","owner":"dantecatalfamo","description":"wren bindings for zig","archived":false,"fork":false,"pushed_at":"2022-11-09T04:41:30.000Z","size":103,"stargazers_count":26,"open_issues_count":1,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-06T06:08:35.175Z","etag":null,"topics":["bindings","wren","wren-bindings","zig","zig-library"],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dantecatalfamo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-08T23:38:35.000Z","updated_at":"2024-04-16T20:31:31.000Z","dependencies_parsed_at":"2023-01-21T18:18:28.483Z","dependency_job_id":null,"html_url":"https://github.com/dantecatalfamo/wren-zig","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dantecatalfamo%2Fwren-zig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dantecatalfamo%2Fwren-zig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dantecatalfamo%2Fwren-zig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dantecatalfamo%2Fwren-zig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dantecatalfamo","download_url":"https://codeload.github.com/dantecatalfamo/wren-zig/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254131991,"owners_count":22020059,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bindings","wren","wren-bindings","zig","zig-library"],"created_at":"2024-08-03T04:00:59.467Z","updated_at":"2025-05-14T11:34:10.747Z","avatar_url":"https://github.com/dantecatalfamo.png","language":"Zig","funding_links":[],"categories":["Libraries"],"sub_categories":[],"readme":"# wren-zig\n[Wren](https://wren.io/) bindings for [zig](https://ziglang.org/)!\n\nWren is a fast lua-sized scripting language with classes and concurrency.\n\nDetails on how embedding wren works [here](https://wren.io/embedding/).\n\n## Bindings\n\nIn `src/wren.zig`\n\nContains both bare bindings and a zig wrapper\n\n```zig\nwrenGetSlotDouble(vm, 0);\n\nvm.getSlotDouble(0);\n```\n\n## Embedding\n\nRecursively clone this repository and add the following to your `build.zig`, with the paths changed to match the correct location\n\n```zig\nconst addWren = @import(\"wren-zig/build.zig\").addWren;\n\npub fn build(b: *std.build.Builder) void {\n    [...]\n    const exe = b.addExecutable(\"wren-zig\", \"src/main.zig\");\n    addWren(exe);\n    [...]\n}\n```\n\n## Example\n\nA very basic example\n\n```zig\nconst std = @import(\"std\");\nconst wren = @import(\"wren\");\n\npub fn main() anyerror!void {\n    var config = wren.newConfig();\n    config.write_fn = writeFn;\n    config.error_fn = errorFn;\n    var vm = wren.wrenNewVM(\u0026config);\n    defer vm.free();\n\n    try vm.interpret(\"main\", \"System.print(\\\"Hello, world!\\\")\");\n}\n\npub export fn writeFn(vm: *wren.WrenVM, text: [*:0]const u8) void {\n    _ = vm;\n    const stdout = std.io.getStdOut().writer();\n    stdout.print(\"{s}\", .{ text }) catch unreachable;\n}\n\npub export fn errorFn(vm: *wren.WrenVM, error_type: wren.WrenErrorType, module: [*:0]const u8, line: c_int, msg: [*:0]const u8) void {\n    _ = vm;\n    const stderr = std.io.getStdErr().writer();\n    switch (error_type) {\n        .WREN_ERROR_COMPILE =\u003e stderr.print(\"[{s} line {d}] [Error] {s}\\n\", .{ module, line, msg }) catch unreachable,\n        .WREN_ERROR_STACK_TRACE =\u003e stderr.print(\"[{s} line {d}] in {s}\\n\", .{ module, line, msg }) catch unreachable,\n        .WREN_ERROR_RUNTIME =\u003e stderr.print(\"[Runtime Error] {s}\\n\", .{ msg }) catch unreachable,\n    }\n}\n```\n\nSee `src/main.zig` for more advanced use cases\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdantecatalfamo%2Fwren-zig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdantecatalfamo%2Fwren-zig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdantecatalfamo%2Fwren-zig/lists"}