Skip to content

Commit 0cd4956

Browse files
committed
Clarify documention around error handling
1 parent 9c31a17 commit 0cd4956

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

src/lib.zig

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
//! Similar to the Lua C API documentation, each function has an indicator to describe how interacts with the stack and which errors it may return.
1+
//! *To avoid a duplication of efforts, Ziglua does not contain full
2+
//! documentation on the Lua C API. Please refer to the [Lua C API Documentation](https://www.lua.org/manual/5.5/manual.html#4)
3+
//! for full details.*
24
//!
3-
//! Instead of using the form `[-o, +p, x]`, zlua uses the words **Pops**, **Pushes**, and **Lua Errors** for clarity.
5+
//! ## Error Handling
6+
//!
7+
//! Similar to the Lua C API documentation, each function has an indicator to describe how interacts with the stack and which errors it may raise.
8+
//!
9+
//! Instead of using the `[-o, +p, x]` notation found in the Lua reference manual, zlua uses the words **Pops**, **Pushes**, and **Lua Errors** for clarity.
410
//!
511
//! * **Pops**: how many elements the function pops from the stack.
612
//! * **Pushes**: how many elements the function pushes onto the stack.
@@ -13,6 +19,10 @@
1319
//! * `see docs` means the function may raise the errors explained in the docs.
1420
//! * `any` means the function can run arbitrary Lua code, either directly or through metamethods, and therefore may raise any errors.
1521
//!
22+
//! If a Lua error is raised in a protected environment (created by calling either `pcall()` or `lua.protectedCall()`), the error is
23+
//! handled and returned to the caller. An error raised outside a protected environment panics and aborts the process.
24+
//! See https://www.lua.org/manual/5.5/manual.html#4.4 for more details.
25+
//!
1626
//! See [Lua](/ziglua/#zlua.Lua) for documentation on the Lua state.
1727

1828
const std = @import("std");

0 commit comments

Comments
 (0)