@@ -1332,11 +1332,10 @@ test "aux check functions" {
1332
1332
fn inner (l : * Lua ) i32 {
1333
1333
l .checkAny (1 );
1334
1334
_ = l .checkInteger (2 );
1335
- _ = l .checkBytes (3 );
1336
- _ = l .checkNumber (4 );
1337
- _ = l .checkString (5 );
1338
- l .checkType (6 , .boolean );
1339
- _ = if (ziglua .lang == .lua52 ) l .checkUnsigned (7 );
1335
+ _ = l .checkNumber (3 );
1336
+ _ = l .checkString (4 );
1337
+ l .checkType (5 , .boolean );
1338
+ _ = if (ziglua .lang == .lua52 ) l .checkUnsigned (6 );
1340
1339
return 0 ;
1341
1340
}
1342
1341
}.inner );
@@ -1365,29 +1364,18 @@ test "aux check functions" {
1365
1364
lua .pushFunction (function );
1366
1365
lua .pushNil ();
1367
1366
lua .pushInteger (3 );
1368
- _ = lua .pushString ("hello world" );
1369
- lua .protectedCall (3 , 0 , 0 ) catch {
1370
- try expectStringContains ("number expected" , try lua .toString (-1 ));
1371
- lua .pop (-1 );
1372
- };
1373
-
1374
- lua .pushFunction (function );
1375
- lua .pushNil ();
1376
- lua .pushInteger (3 );
1377
- _ = lua .pushString ("hello world" );
1378
1367
lua .pushNumber (4 );
1379
- lua .protectedCall (4 , 0 , 0 ) catch {
1368
+ lua .protectedCall (3 , 0 , 0 ) catch {
1380
1369
try expectStringContains ("string expected" , try lua .toString (-1 ));
1381
1370
lua .pop (-1 );
1382
1371
};
1383
1372
1384
1373
lua .pushFunction (function );
1385
1374
lua .pushNil ();
1386
1375
lua .pushInteger (3 );
1387
- _ = lua .pushString ("hello world" );
1388
1376
lua .pushNumber (4 );
1389
- _ = lua .pushStringZ ("hello world" );
1390
- lua .protectedCall (5 , 0 , 0 ) catch {
1377
+ _ = lua .pushString ("hello world" );
1378
+ lua .protectedCall (4 , 0 , 0 ) catch {
1391
1379
try expectStringContains ("boolean expected" , try lua .toString (-1 ));
1392
1380
lua .pop (-1 );
1393
1381
};
@@ -1396,12 +1384,11 @@ test "aux check functions" {
1396
1384
lua .pushFunction (function );
1397
1385
lua .pushNil ();
1398
1386
lua .pushInteger (3 );
1399
- _ = lua .pushString ("hello world" );
1400
1387
lua .pushNumber (4 );
1401
- _ = lua .pushStringZ ("hello world" );
1388
+ _ = lua .pushString ("hello world" );
1402
1389
lua .pushBoolean (true );
1403
- lua .protectedCall (6 , 0 , 0 ) catch {
1404
- try expectEqualStrings ("bad argument #7 to '?' (number expected, got no value)" , try lua .toString (-1 ));
1390
+ lua .protectedCall (5 , 0 , 0 ) catch {
1391
+ try expectEqualStrings ("bad argument #6 to '?' (number expected, got no value)" , try lua .toString (-1 ));
1405
1392
lua .pop (-1 );
1406
1393
};
1407
1394
}
@@ -1410,14 +1397,13 @@ test "aux check functions" {
1410
1397
// test pushFail here (currently acts the same as pushNil)
1411
1398
if (ziglua .lang == .lua54 ) lua .pushFail () else lua .pushNil ();
1412
1399
lua .pushInteger (3 );
1413
- _ = lua .pushString ("hello world" );
1414
1400
lua .pushNumber (4 );
1415
- _ = lua .pushStringZ ("hello world" );
1401
+ _ = lua .pushString ("hello world" );
1416
1402
lua .pushBoolean (true );
1417
1403
if (ziglua .lang == .lua52 ) {
1418
1404
lua .pushUnsigned (1 );
1419
- try lua .protectedCall (7 , 0 , 0 );
1420
- } else try lua .protectedCall (6 , 0 , 0 );
1405
+ try lua .protectedCall (6 , 0 , 0 );
1406
+ } else try lua .protectedCall (5 , 0 , 0 );
1421
1407
}
1422
1408
1423
1409
test "aux opt functions" {
@@ -1427,9 +1413,9 @@ test "aux opt functions" {
1427
1413
const function = ziglua .wrap (struct {
1428
1414
fn inner (l : * Lua ) i32 {
1429
1415
expectEqual (10 , l .optInteger (1 , 10 )) catch unreachable ;
1430
- expectEqualStrings ("zig" , l .optBytes (2 , "zig" )) catch unreachable ;
1416
+ expectEqualStrings ("zig" , l .optString (2 , "zig" )) catch unreachable ;
1431
1417
expectEqual (1.23 , l .optNumber (3 , 1.23 )) catch unreachable ;
1432
- expectEqualStrings ("lang" , std . mem . span ( l .optString (4 , "lang" ) )) catch unreachable ;
1418
+ expectEqualStrings ("lang" , l .optString (4 , "lang" )) catch unreachable ;
1433
1419
return 0 ;
1434
1420
}
1435
1421
}.inner );
@@ -2333,7 +2319,7 @@ test "namecall" {
2333
2319
2334
2320
pub fn vectorNamecall (l : * Lua ) i32 {
2335
2321
const atom_idx , _ = l .namecallAtom () catch {
2336
- l .raiseErrorStr ("%s is not a valid vector method" , .{l .checkString (1 )});
2322
+ l .raiseErrorStr ("%s is not a valid vector method" , .{l .checkString (1 ). ptr });
2337
2323
};
2338
2324
switch (atom_idx ) {
2339
2325
dot_idx = > {
0 commit comments