mirror of
https://github.com/MezzalunaWM/Mezzaluna.git
synced 2026-03-08 20:57:32 -04:00
reformatted with zig fmt
This commit is contained in:
parent
e6a45f91b6
commit
6be66b6a71
32 changed files with 2108 additions and 2237 deletions
|
|
@ -6,23 +6,23 @@ const zlua = @import("zlua");
|
|||
const gpa = std.heap.c_allocator;
|
||||
|
||||
pub fn getNestedField(L: *zlua.Lua, path: []u8) bool {
|
||||
var tokens = std.mem.tokenizeScalar(u8, path, '.');
|
||||
var first = true;
|
||||
var tokens = std.mem.tokenizeScalar(u8, path, '.');
|
||||
var first = true;
|
||||
|
||||
while (tokens.next()) |token| {
|
||||
const tok = gpa.dupeZ(u8, token) catch return false;
|
||||
if (first) {
|
||||
_ = L.getGlobal(tok) catch return false;
|
||||
first = false;
|
||||
} else {
|
||||
_ = L.getField(-1, tok);
|
||||
L.remove(-2);
|
||||
while (tokens.next()) |token| {
|
||||
const tok = gpa.dupeZ(u8, token) catch return false;
|
||||
if (first) {
|
||||
_ = L.getGlobal(tok) catch return false;
|
||||
first = false;
|
||||
} else {
|
||||
_ = L.getField(-1, tok);
|
||||
L.remove(-2);
|
||||
}
|
||||
|
||||
if (L.isNil(-1)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (L.isNil(-1)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue