@@ -766,13 +766,8 @@ pub const Lua = struct {
766766 lua .pushClosure (c_fn , 0 );
767767 }
768768
769- /// Push a formatted string onto the stack
770- pub fn pushFString (lua : * Lua , fmt : [:0 ]const u8 , args : anytype ) void {
771- _ = lua .pushFStringEx (fmt , args );
772- }
773-
774769 /// Push a formatted string onto the stack and return a pointer to the string
775- pub fn pushFStringEx (lua : * Lua , fmt : [:0 ]const u8 , args : anytype ) [* :0 ]const u8 {
770+ pub fn pushFString (lua : * Lua , fmt : [:0 ]const u8 , args : anytype ) [* :0 ]const u8 {
776771 return @call (.auto , c .lua_pushfstring , .{ lua .state , fmt .ptr } ++ args );
777772 }
778773
@@ -794,13 +789,8 @@ pub const Lua = struct {
794789 c .lua_pushlightuserdata (lua .state , ptr );
795790 }
796791
797- /// Pushes a slice of bytes onto the stack
798- pub fn pushBytes (lua : * Lua , bytes : []const u8 ) void {
799- _ = lua .pushBytesEx (bytes );
800- }
801-
802792 /// Pushes the bytes onto the stack. Returns a slice pointing to Lua's internal copy of the string
803- pub fn pushBytesEx (lua : * Lua , bytes : []const u8 ) []const u8 {
793+ pub fn pushBytes (lua : * Lua , bytes : []const u8 ) []const u8 {
804794 return c .lua_pushlstring (lua .state , bytes .ptr , bytes .len )[0.. bytes .len ];
805795 }
806796
@@ -814,26 +804,16 @@ pub const Lua = struct {
814804 c .lua_pushnumber (lua .state , n );
815805 }
816806
817- /// Pushes a zero-terminated string on to the stack
818- pub fn pushString (lua : * Lua , str : [:0 ]const u8 ) void {
819- _ = lua .pushStringEx (str );
820- }
821-
822807 /// Pushes a zero-terminated string onto the stack
823808 /// Lua makes a copy of the string so `str` may be freed immediately after return
824809 /// Returns a pointer to the internal Lua string
825- pub fn pushStringEx (lua : * Lua , str : [:0 ]const u8 ) [:0 ]const u8 {
810+ pub fn pushString (lua : * Lua , str : [:0 ]const u8 ) [:0 ]const u8 {
826811 return c .lua_pushstring (lua .state , str .ptr )[0.. str .len :0 ];
827812 }
828813
829- /// Pushes this thread onto the stack
830- pub fn pushThread (lua : * Lua ) void {
831- _ = lua .pushThreadEx ();
832- }
833-
834814 /// Pushes this thread onto the stack
835815 /// Returns true if this thread is the main thread of its state
836- pub fn pushThreadEx (lua : * Lua ) bool {
816+ pub fn pushThread (lua : * Lua ) bool {
837817 return c .lua_pushthread (lua .state ) != 0 ;
838818 }
839819
@@ -1169,14 +1149,9 @@ pub const Lua = struct {
11691149 }
11701150 }
11711151
1172- /// Gets information about a local variable
1173- pub fn getLocal (lua : * Lua , info : * DebugInfo , n : i32 ) ! void {
1174- _ = try lua .getLocalEx (info , n );
1175- }
1176-
11771152 /// Gets information about a local variable
11781153 /// Returns the name of the local variable
1179- pub fn getLocalEx (lua : * Lua , info : * DebugInfo , n : i32 ) ! [:0 ]const u8 {
1154+ pub fn getLocal (lua : * Lua , info : * DebugInfo , n : i32 ) ! [:0 ]const u8 {
11801155 var ar : Debug = undefined ;
11811156 ar .i_ci = @ptrCast (* c .struct_CallInfo , info .private );
11821157 if (c .lua_getlocal (lua .state , & ar , n )) | name | {
@@ -1206,15 +1181,10 @@ pub const Lua = struct {
12061181 _ = c .lua_sethook (lua .state , hook_fn , hook_mask , count );
12071182 }
12081183
1209- /// Sets the value of a local variable
1210- pub fn setLocal (lua : * Lua , info : * DebugInfo , n : i32 ) ! void {
1211- _ = try lua .setLocalEx (info , n );
1212- }
1213-
12141184 /// Sets the value of a local variable
12151185 /// Returns an error when the index is greater than the number of active locals
12161186 /// Returns the name of the local variable
1217- pub fn setLocalEx (lua : * Lua , info : * DebugInfo , n : i32 ) ! [:0 ]const u8 {
1187+ pub fn setLocal (lua : * Lua , info : * DebugInfo , n : i32 ) ! [:0 ]const u8 {
12181188 var ar : Debug = undefined ;
12191189 ar .i_ci = @ptrCast (* c .struct_CallInfo , info .private );
12201190 if (c .lua_setlocal (lua .state , & ar , n )) | name | {
@@ -1223,15 +1193,9 @@ pub const Lua = struct {
12231193 return error .Fail ;
12241194 }
12251195
1226- /// Sets the value of a closure's upvalue
1227- /// Returns an error if the upvalu does not exist
1228- pub fn setUpvalue (lua : * Lua , func_index : i32 , n : i32 ) ! void {
1229- _ = try lua .setUpvalueEx (func_index , n );
1230- }
1231-
12321196 /// Sets the value of a closure's upvalue
12331197 /// Returns the name of the upvalue or an error if the upvalue does not exist
1234- pub fn setUpvalueEx (lua : * Lua , func_index : i32 , n : i32 ) ! [:0 ]const u8 {
1198+ pub fn setUpvalue (lua : * Lua , func_index : i32 , n : i32 ) ! [:0 ]const u8 {
12351199 if (c .lua_setupvalue (lua .state , func_index , n )) | name | {
12361200 return std .mem .span (name );
12371201 }
@@ -1315,7 +1279,7 @@ pub const Lua = struct {
13151279 }
13161280 }
13171281
1318- return lua .argError (arg , lua .pushFStringEx ("invalid option '%s'" , .{name .ptr }));
1282+ return lua .argError (arg , lua .pushFString ("invalid option '%s'" , .{name .ptr }));
13191283 }
13201284
13211285 /// Grows the stack size to top + `size` elements, raising an error if the stack cannot grow to that size
0 commit comments