docs: update docs on tointegerx and tonumberx
This commit is contained in:
parent
f5484c6c4a
commit
5fa582d886
4
docs.md
4
docs.md
|
@ -44,6 +44,10 @@ These functions have been combined into `Lua.toString()`. The function `lua_tost
|
|||
|
||||
The length of the returned string is almost always needed, so `Lua.toString() returns a zero-terminated Zig slice of the bytes with the correct length.
|
||||
|
||||
### `lua_tointegerx` and `lua_tonumberx`
|
||||
|
||||
Both of these functions accept an `isnum` return parameter to indicate if the conversion to number was successful. In the Zig version, both functions return either the number, or an error indicating the conversion was unsuccessful, and the `isnum` parameter is omitted.
|
||||
|
||||
## Examples
|
||||
|
||||
Here are more thorough examples that show off the ziglua bindings in context. All examples use previously documented [`build.zig`](#build-documentation) setup.
|
||||
|
|
|
@ -6,9 +6,10 @@ A Zig library that provides a lightweight wrapper around the [Lua C API](https:/
|
|||
|
||||
In a nutshell, ziglua is a simple wrapper around the C API you would get by using `@cImport()` to bind Lua. ziglua aims to mirror the [Lua C API](https://www.lua.org/manual/5.4/manual.html#4) as closely as possible, while improving ergonomics using Zig's features. For example:
|
||||
|
||||
* Zig error unions to enforce failure state handling
|
||||
* Null-terminated slices instead of C strings
|
||||
* Type-checked enums for parameters and return values
|
||||
* Compiler-enforced checking of optional pointers
|
||||
* Zig error unions to enforce error checking of failure states
|
||||
* Functions return `bool` rather than `int` to indicate success
|
||||
|
||||
While there are a few helper functions added to complement the C API, ziglua aims to remain low-level. If you want something higher-level, perhaps try [zoltan](https://github.com/ranciere/zoltan).
|
||||
|
|
Loading…
Reference in New Issue
Block a user