Skip to content

Commit

Permalink
Rename toBytesFmt to toStringEx
Browse files Browse the repository at this point in the history
I can't think of a better name at the moment, but at least this is an
improvement
  • Loading branch information
natecraddock committed Mar 20, 2024
1 parent b93287d commit 6a75ad1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2876,8 +2876,9 @@ pub const Lua = struct {
}

/// Converts any Lua value at the given index into a string in a reasonable format
/// Uses the __tostring metamethod if available
/// See https://www.lua.org/manual/5.4/manual.html#luaL_tolstring
pub fn toBytesFmt(lua: *Lua, index: i32) [:0]const u8 {
pub fn toStringEx(lua: *Lua, index: i32) [:0]const u8 {
var length: usize = undefined;
const ptr = c.luaL_tolstring(lua.state, index, &length);
return ptr[0..length :0];
Expand Down

1 comment on commit 6a75ad1

@VisenDev
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

valueToString perhaps?
or stringFromValue following zig's builtin function naming conventions?

Please sign in to comment.