@@ -253,9 +253,12 @@ test "type of and getting values" {
253
253
lua .pushNil ();
254
254
lua .pushNumber (0.1 );
255
255
_ = lua .pushThread ();
256
- _ = lua .pushString ("all your codebase are belong to us" );
256
+ try expectEqualStrings (
257
+ "all your codebase are belong to us" ,
258
+ lua .pushStringEx ("all your codebase are belong to us" ),
259
+ );
257
260
lua .pushFunction (ziglua .wrap (add ));
258
- _ = lua .pushBytes ("hello world" );
261
+ try expectEqualStrings ( "hello world" , lua .pushBytesEx ("hello world" ) );
259
262
_ = lua .pushFString ("%s %s %d" , .{ "hello" , "world" , @as (i32 , 10 ) });
260
263
lua .pushValue (1 );
261
264
@@ -496,7 +499,7 @@ test "global table" {
496
499
lua .pushGlobalTable ();
497
500
498
501
// find the print function
499
- _ = lua .pushString ("print" );
502
+ lua .pushString ("print" );
500
503
try expectEqual (LuaType .function , lua .getTable (-2 ));
501
504
502
505
// index the global table in the global table
@@ -585,9 +588,9 @@ test "concat" {
585
588
var lua = try Lua .init (testing .allocator );
586
589
defer lua .deinit ();
587
590
588
- _ = lua .pushString ("hello " );
591
+ lua .pushString ("hello " );
589
592
lua .pushNumber (10 );
590
- _ = lua .pushString (" wow!" );
593
+ lua .pushString (" wow!" );
591
594
lua .concat (3 );
592
595
593
596
try expectEqualStrings ("hello 10.0 wow!" , try lua .toBytes (-1 ));
@@ -635,22 +638,22 @@ test "table access" {
635
638
try expectEqual (LuaType .string , lua .rawGetIndex (1 , 1 ));
636
639
try expectEqualStrings ("first" , try lua .toBytes (-1 ));
637
640
638
- _ = lua .pushString ("key" );
641
+ lua .pushString ("key" );
639
642
try expectEqual (LuaType .string , lua .getTable (1 ));
640
643
try expectEqualStrings ("value" , try lua .toBytes (-1 ));
641
644
642
- _ = lua .pushString ("other one" );
645
+ lua .pushString ("other one" );
643
646
try expectEqual (LuaType .number , lua .rawGetTable (1 ));
644
647
try expectEqual (@as (Integer , 1234 ), try lua .toInteger (-1 ));
645
648
646
649
// a.name = "ziglua"
647
- _ = lua .pushString ("name" );
648
- _ = lua .pushString ("ziglua" );
650
+ lua .pushString ("name" );
651
+ lua .pushString ("ziglua" );
649
652
lua .setTable (1 );
650
653
651
654
// a.lang = "zig"
652
- _ = lua .pushString ("lang" );
653
- _ = lua .pushString ("zig" );
655
+ lua .pushString ("lang" );
656
+ lua .pushString ("zig" );
654
657
lua .rawSetTable (1 );
655
658
656
659
try expectError (Error .Fail , lua .getMetatable (1 ));
@@ -800,7 +803,7 @@ test "userdata and uservalues" {
800
803
lua .pushNumber (1234.56 );
801
804
try lua .setIndexUserValue (1 , 1 );
802
805
803
- _ = lua .pushString ("test string" );
806
+ lua .pushString ("test string" );
804
807
try lua .setIndexUserValue (1 , 2 );
805
808
806
809
try expectEqual (LuaType .number , try lua .getIndexUserValue (1 , 1 ));
@@ -881,7 +884,7 @@ test "registry" {
881
884
const key = "mykey" ;
882
885
883
886
// store a string in the registry
884
- _ = lua .pushString ("hello there" );
887
+ lua .pushString ("hello there" );
885
888
lua .rawSetPtr (ziglua .registry_index , key );
886
889
887
890
// get key from the registry
@@ -926,7 +929,7 @@ test "raise error" {
926
929
927
930
const makeError = struct {
928
931
fn inner (l : * Lua ) i32 {
929
- _ = l .pushString ("makeError made an error" );
932
+ l .pushString ("makeError made an error" );
930
933
l .raiseError ();
931
934
return 0 ;
932
935
}
@@ -941,7 +944,7 @@ fn continuation(l: *Lua, status: ziglua.Status, ctx: isize) i32 {
941
944
_ = status ;
942
945
943
946
if (ctx == 5 ) {
944
- _ = l .pushString ("done" );
947
+ l .pushString ("done" );
945
948
return 1 ;
946
949
} else {
947
950
// yield the current context value
@@ -1168,7 +1171,7 @@ test "aux check functions" {
1168
1171
lua .pushFunction (function );
1169
1172
lua .pushNil ();
1170
1173
lua .pushInteger (3 );
1171
- _ = lua .pushBytes ("hello world" );
1174
+ lua .pushBytes ("hello world" );
1172
1175
lua .protectedCall (3 , 0 , 0 ) catch {
1173
1176
try expectEqualStrings ("bad argument #4 to '?' (number expected, got no value)" , try lua .toBytes (-1 ));
1174
1177
lua .pop (-1 );
@@ -1177,7 +1180,7 @@ test "aux check functions" {
1177
1180
lua .pushFunction (function );
1178
1181
lua .pushNil ();
1179
1182
lua .pushInteger (3 );
1180
- _ = lua .pushBytes ("hello world" );
1183
+ lua .pushBytes ("hello world" );
1181
1184
lua .pushNumber (4 );
1182
1185
lua .protectedCall (4 , 0 , 0 ) catch {
1183
1186
try expectEqualStrings ("bad argument #5 to '?' (string expected, got no value)" , try lua .toBytes (-1 ));
@@ -1187,9 +1190,9 @@ test "aux check functions" {
1187
1190
lua .pushFunction (function );
1188
1191
lua .pushNil ();
1189
1192
lua .pushInteger (3 );
1190
- _ = lua .pushBytes ("hello world" );
1193
+ lua .pushBytes ("hello world" );
1191
1194
lua .pushNumber (4 );
1192
- _ = lua .pushString ("hello world" );
1195
+ lua .pushString ("hello world" );
1193
1196
lua .protectedCall (5 , 0 , 0 ) catch {
1194
1197
try expectEqualStrings ("bad argument #6 to '?' (boolean expected, got no value)" , try lua .toBytes (-1 ));
1195
1198
lua .pop (-1 );
@@ -1198,9 +1201,9 @@ test "aux check functions" {
1198
1201
lua .pushFunction (function );
1199
1202
lua .pushNil ();
1200
1203
lua .pushInteger (3 );
1201
- _ = lua .pushBytes ("hello world" );
1204
+ lua .pushBytes ("hello world" );
1202
1205
lua .pushNumber (4 );
1203
- _ = lua .pushString ("hello world" );
1206
+ lua .pushString ("hello world" );
1204
1207
lua .pushBoolean (true );
1205
1208
lua .protectedCall (6 , 0 , 0 ) catch {
1206
1209
try expectEqualStrings ("bad argument #6 to '?' (boolean expected, got no value)" , try lua .toBytes (-1 ));
@@ -1210,9 +1213,9 @@ test "aux check functions" {
1210
1213
lua .pushFunction (function );
1211
1214
lua .pushNil ();
1212
1215
lua .pushInteger (3 );
1213
- _ = lua .pushBytes ("hello world" );
1216
+ lua .pushBytes ("hello world" );
1214
1217
lua .pushNumber (4 );
1215
- _ = lua .pushString ("hello world" );
1218
+ lua .pushString ("hello world" );
1216
1219
lua .pushBoolean (true );
1217
1220
try lua .protectedCall (6 , 0 , 0 );
1218
1221
}
0 commit comments