tony / oxwm

config/lua: use `bufPrintZ` and remove manual null terminator in package.path setup Browse files
emzywastaken committed 2026-03-01 parent cddc305 commit 6d5bfbd80fa53f20c29f308a4224f9ba4198ff65
Showing 1 changed file with 1 additions and 1 deletions. UnifiedSplit
+1 −1 src/config/lua.zig
@@ -43,7 +43,7 @@ pub fn loadFile(path: []const u8) bool {
43 if (std.mem.lastIndexOfScalar(u8, path, '/')) |last_slash| { 43 if (std.mem.lastIndexOfScalar(u8, path, '/')) |last_slash| {
44 const dir = path[0..last_slash]; 44 const dir = path[0..last_slash];
45 var setup_buf: [600]u8 = undefined; 45 var setup_buf: [600]u8 = undefined;
46 - const setup_code = std.fmt.bufPrint(&setup_buf, "package.path = '{s}/?.lua;' .. package.path\x00", .{dir}) catch return false; 46 + const setup_code = std.fmt.bufPrintZ(&setup_buf, "package.path = '{s}/?.lua;' .. package.path", .{dir}) catch return false;
47 if (c.luaL_loadstring(state, setup_code.ptr) != 0 or c.lua_pcallk(state, 0, 0, 0, 0, null) != 0) { 47 if (c.luaL_loadstring(state, setup_code.ptr) != 0 or c.lua_pcallk(state, 0, 0, 0, 0, null) != 0) {
48 c.lua_settop(state, -2); 48 c.lua_settop(state, -2);
49 return false; 49 return false;