Something went wrong. Try again.
🦦 a tiny cute lua web framework
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930const std = @import("std");
const fern = @import("fern");const zlua = @import("zlua");pub const Lua = zlua.Lua;
const maivi = @import("../root.zig");
/// * Pops from Stack: `(args.args + 1)`/// * Pushes to Stack: `(args.results|1)`pub fn pcall(l: *Lua, args: Lua.ProtectedCallArgs) !void { return l.protectedCall(args) catch |err| switch (err) { error.LuaRuntime => { const msg = try l.toString(-1); l.pop(1); l.traceback(l, msg, 1); const str = try l.toString(-1); l.pop(1); const e = try maivi.allocator.dupe(u8, str); defer maivi.allocator.free(e); fern.err().ctx("lua.pcall").str("err", e).log(); return err; }, else => { fern.err().ctx("lua.pcall").err(err).log(); return err; }, };}