@@ -250,7 +250,7 @@ test "type of and getting values" {
250
250
_ = lua .pushString ("all your codebase are belong to us" );
251
251
try expectEqual (@as (? [* ]const u8 , null ), lua .pushString (null ));
252
252
lua .pushCFunction (ziglua .wrap (add ));
253
- _ = lua .pushLString ("hello world" );
253
+ _ = lua .pushBytes ("hello world" );
254
254
_ = lua .pushFString ("%s %s %d" , .{ "hello" , "world" , @as (i32 , 10 ) });
255
255
lua .pushValue (1 );
256
256
@@ -285,7 +285,7 @@ test "type of and getting values" {
285
285
try expect (lua .isString (12 ));
286
286
try expect (lua .isBoolean (13 ));
287
287
288
- try expectEqualStrings ("hello world 10" , lua .toString (12 ).? );
288
+ try expectEqualStrings ("hello world 10" , try lua .toBytes (12 ));
289
289
290
290
// the created thread should equal the main thread (but created thread has no allocator ref)
291
291
try expectEqual (lua .state , (try lua .toThread (7 )).state );
@@ -466,7 +466,7 @@ test "string buffers" {
466
466
try expectEqualStrings ("ziglua api some text here" , buffer .addr ());
467
467
468
468
buffer .pushResult ();
469
- try expectEqualStrings ("ziglua api some text here" , lua .toString (-1 ).? );
469
+ try expectEqualStrings ("ziglua api some text here" , try lua .toBytes (-1 ));
470
470
471
471
// now test a small buffer
472
472
buffer = undefined ;
@@ -478,7 +478,7 @@ test "string buffers" {
478
478
b = buffer .prep ();
479
479
std .mem .copy (u8 , b , "defghijklmnopqrstuvwxyz" );
480
480
buffer .pushResultSize (23 );
481
- try expectEqualStrings ("abcdefghijklmnopqrstuvwxyz" , lua .toString (-1 ).? );
481
+ try expectEqualStrings ("abcdefghijklmnopqrstuvwxyz" , try lua .toBytes (-1 ));
482
482
483
483
lua .len (-1 );
484
484
try expectEqual (@as (Integer , 26 ), lua .toInteger (-1 ));
@@ -587,7 +587,7 @@ test "concat" {
587
587
_ = lua .pushString (" wow!" );
588
588
lua .concat (3 );
589
589
590
- try expectEqualStrings ("hello 10.0 wow!" , lua .toString (-1 ).? );
590
+ try expectEqualStrings ("hello 10.0 wow!" , try lua .toBytes (-1 ));
591
591
}
592
592
593
593
test "garbage collector" {
@@ -627,14 +627,14 @@ test "table access" {
627
627
_ = lua .getGlobal ("a" );
628
628
629
629
try expectEqual (LuaType .string , lua .getIndex (1 , 1 ));
630
- try expectEqualStrings ("first" , lua .toString (-1 ).? );
630
+ try expectEqualStrings ("first" , try lua .toBytes (-1 ));
631
631
632
632
try expectEqual (LuaType .string , lua .rawGetIndex (1 , 1 ));
633
- try expectEqualStrings ("first" , lua .toString (-1 ).? );
633
+ try expectEqualStrings ("first" , try lua .toBytes (-1 ));
634
634
635
635
_ = lua .pushString ("key" );
636
636
try expectEqual (LuaType .string , lua .getTable (1 ));
637
- try expectEqualStrings ("value" , lua .toString (-1 ).? );
637
+ try expectEqualStrings ("value" , try lua .toBytes (-1 ));
638
638
639
639
_ = lua .pushString ("other one" );
640
640
try expectEqual (LuaType .number , lua .rawGetTable (1 ));
@@ -803,7 +803,7 @@ test "userdata and uservalues" {
803
803
try expectEqual (LuaType .number , try lua .getIndexUserValue (1 , 1 ));
804
804
try expectEqual (@as (Number , 1234.56 ), lua .toNumber (-1 ));
805
805
try expectEqual (LuaType .string , try lua .getIndexUserValue (1 , 2 ));
806
- try expectEqualStrings ("test string" , lua .toString (-1 ).? );
806
+ try expectEqualStrings ("test string" , try lua .toBytes (-1 ));
807
807
808
808
try expectError (Error .Fail , lua .setIndexUserValue (1 , 3 ));
809
809
try expectError (Error .Fail , lua .getIndexUserValue (1 , 3 ));
@@ -854,15 +854,15 @@ test "table traversal" {
854
854
while (lua .next (1 )) {
855
855
switch (lua .typeOf (-1 )) {
856
856
.string = > {
857
- try expectEqualStrings ("key" , lua .toString (-2 ).? );
858
- try expectEqualStrings ("value" , lua .toString (-1 ).? );
857
+ try expectEqualStrings ("key" , try lua .toBytes (-2 ));
858
+ try expectEqualStrings ("value" , try lua .toBytes (-1 ));
859
859
},
860
860
.boolean = > {
861
- try expectEqualStrings ("second" , lua .toString (-2 ).? );
861
+ try expectEqualStrings ("second" , try lua .toBytes (-2 ));
862
862
try expectEqual (true , lua .toBoolean (-1 ));
863
863
},
864
864
.number = > {
865
- try expectEqualStrings ("third" , lua .toString (-2 ).? );
865
+ try expectEqualStrings ("third" , try lua .toBytes (-2 ));
866
866
try expectEqual (@as (Integer , 1 ), lua .toInteger (-1 ));
867
867
},
868
868
else = > unreachable ,
@@ -883,7 +883,7 @@ test "registry" {
883
883
884
884
// get key from the registry
885
885
_ = lua .rawGetPtr (ziglua .registry_index , key );
886
- try expectEqualStrings ("hello there" , lua .toString (-1 ).? );
886
+ try expectEqualStrings ("hello there" , try lua .toBytes (-1 ));
887
887
}
888
888
889
889
test "closing vars" {
@@ -931,7 +931,7 @@ test "raise error" {
931
931
932
932
lua .pushCFunction (ziglua .wrap (makeError ));
933
933
try expectError (Error .Runtime , lua .protectedCall (0 , 0 , 0 ));
934
- try expectEqualStrings ("makeError made an error" , lua .toString (-1 ).? );
934
+ try expectEqualStrings ("makeError made an error" , try lua .toBytes (-1 ));
935
935
}
936
936
937
937
fn continuation (l : * Lua , status : ziglua.Status , ctx : isize ) i32 {
@@ -973,7 +973,7 @@ test "yielding" {
973
973
thread .pop (results );
974
974
}
975
975
try expectEqual (ziglua .ResumeStatus .ok , try thread .resumeThread (lua , 0 , & results ));
976
- try expectEqualStrings ("done" , thread .toString (-1 ).? );
976
+ try expectEqualStrings ("done" , try thread .toBytes (-1 ));
977
977
}
978
978
979
979
test "refs" {
0 commit comments