Skip to content

Commit 7e57394

Browse files
committed
Cleanup docs for Lua.init
1 parent d3b9528 commit 7e57394

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/lib.zig

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -622,10 +622,8 @@ pub const Lua = opaque {
622622
/// Initialize a Lua state with the given allocator. Use `Lua.deinit()` to close the state and free memory.
623623
///
624624
/// Creates a new independent state and returns its main thread.
625-
/// Returns NULL if it cannot create the state (due to lack of memory).
626-
/// The argument f is the allocator function; Lua will do all memory allocation
627-
/// for this state through this function (see lua_Alloc). The second argument,
628-
/// ud, is an opaque pointer that Lua passes to the allocator in every call.
625+
/// Returns an error if it cannot create the state (due to lack of memory).
626+
/// Lua will do all memory allocation for this state through the passed Allocator (see lua_Alloc).
629627
///
630628
/// * Pops: `0`
631629
/// * Pushes: `0`
@@ -640,7 +638,6 @@ pub const Lua = opaque {
640638
const allocator_ptr = try a.create(Allocator);
641639
allocator_ptr.* = a;
642640

643-
// @constCast() is safe here because Lua does not mutate the pointer internally
644641
if (c.lua_newstate(alloc, allocator_ptr)) |state| {
645642
return @ptrCast(state);
646643
} else return error.OutOfMemory;

0 commit comments

Comments
 (0)