@@ -1497,12 +1497,14 @@ pub const Lua = struct {
1497
1497
1498
1498
/// Push a formatted string onto the stack and return a pointer to the string
1499
1499
/// See https://www.lua.org/manual/5.4/manual.html#lua_pushfstring
1500
- pub fn pushFString (lua : * Lua , fmt : [:0 ]const u8 , args : anytype ) [* :0 ]const u8 {
1501
- return @call (
1500
+ pub fn pushFString (lua : * Lua , fmt : [:0 ]const u8 , args : anytype ) [:0 ]const u8 {
1501
+ const ptr = @call (
1502
1502
.auto ,
1503
1503
if (lang == .luau ) c .lua_pushfstringL else c .lua_pushfstring ,
1504
1504
.{ lua .state , fmt .ptr } ++ args ,
1505
1505
);
1506
+ const l = lua .rawLen (-1 );
1507
+ return ptr [0.. l :0 ];
1506
1508
}
1507
1509
1508
1510
/// Pushes the global environment onto the stack
@@ -2375,8 +2377,8 @@ pub const Lua = struct {
2375
2377
2376
2378
/// Raises an error reporting a problem with argument `arg` of the C function that called it
2377
2379
/// See https://www.lua.org/manual/5.4/manual.html#luaL_argerror
2378
- pub fn argError (lua : * Lua , arg : i32 , extra_msg : [* :0 ]const u8 ) noreturn {
2379
- _ = c .luaL_argerror (lua .state , arg , extra_msg );
2380
+ pub fn argError (lua : * Lua , arg : i32 , extra_msg : [:0 ]const u8 ) noreturn {
2381
+ _ = c .luaL_argerror (lua .state , arg , extra_msg . ptr );
2380
2382
unreachable ;
2381
2383
}
2382
2384
@@ -2445,8 +2447,8 @@ pub const Lua = struct {
2445
2447
/// Grows the stack size to top + `size` elements, raising an error if the stack cannot grow to that size
2446
2448
/// `msg` is an additional text to go into the error message
2447
2449
/// See https://www.lua.org/manual/5.4/manual.html#luaL_checkstack
2448
- pub fn checkStackErr (lua : * Lua , size : i32 , msg : ? [* :0 ]const u8 ) void {
2449
- c .luaL_checkstack (lua .state , size , msg );
2450
+ pub fn checkStackErr (lua : * Lua , size : i32 , msg : ? [:0 ]const u8 ) void {
2451
+ c .luaL_checkstack (lua .state , size , if ( msg ) | m | m . ptr else null );
2450
2452
}
2451
2453
2452
2454
/// Checks whether the function argument `arg` is a string and returns the string
0 commit comments