Skip to content

Commit 09516fd

Browse files
committed
docs: small updates to the docs
1 parent 0f4faa9 commit 09516fd

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

docs.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44

55
This documentation provides
66

7-
* An overview of ziglua's structure
7+
* An overview of ziglua's structure and changes from the C API
88
* Safety considerations
9-
* API Differences
109
* `build.zig` documentation
1110
* Example code
1211

12+
Documentation on each individual function is found in the [ziglua.zig](https://github.com/natecraddock/ziglua/blob/master/src/ziglua.zig) source code.
13+
1314
## Moving from the C API to Zig
1415

1516
While efforts have been made to keep the ziglua API similar to the C API, many changes have been made including:
@@ -28,13 +29,13 @@ In the few cases when the [auxiliary library](https://www.lua.org/manual/5.4/man
2829

2930
For example, the functions `lua_newstate` and `luaL_newstate` are translated to `Lua.newState` and `Lua.newStateAux` respectively.
3031

31-
Because Zig optimizes for readability, some abbreviations are expanded to make names more clear, like renaming `pcall` to `protectedCall`.
32+
Because Zig best practice is to communicate intent precisely, some abbreviations are expanded to make names more clear, like renaming `pcall` to `protectedCall`.
3233

3334
### Lua Initialization
3435

3536
In the C API, there are two functions provided to initialize the main Lua state: `lua_newstate` and `luaL_newstate`. The former requires passing an allocator function to be used by Lua for all memory allocations, while the latter uses the default libc allocator.
3637

37-
Ziglua provides a third option with the `Lua.init(Allocator)` function, which accepts a traditional Zig allocator. All three functions are available depending on your needs, but most likely you will want to use the `init` function. If you have special requirements for allocation, then `Lua.newState` would be useful. `Lua.newStateAux` is available, but Zig cannot track allocations made by libc so this is less safe.
38+
Ziglua provides a third option with the `Lua.init(Allocator)` function, which accepts a traditional Zig allocator. All three functions are available depending on your needs, but most likely you will want to use the `Lua.init(Allocator)` function. If you have special requirements for allocation, then `Lua.newState` would be useful. `Lua.newStateAux` is available if you wish to use the default libc allocator.
3839

3940
## Safety
4041

@@ -60,7 +61,7 @@ The slices are typed to indicate the contents (zero-terminated, raw bytes, etc)
6061

6162
### Enums
6263

63-
ziglua uses enums instead of enumerated integer codes to ensure all cases are handled, and to prevent passing an invalid integer type to a function.
64+
ziglua uses enums instead of integer codes or strings to prevent passing an invalid value to a function.
6465

6566
### Optionals
6667

0 commit comments

Comments
 (0)