@@ -765,8 +765,8 @@ test "debugTrace shows function names in call stack" {
765765
766766 // Get the innerFunc and set a breakpoint
767767 const func = try lua .globals ().get ("innerFunc" , Lua .Function );
768- defer func .? . deinit ();
769- _ = try func .? . setBreakpoint (2 , true ); // Line 2: return 42
768+ defer func .deinit ();
769+ _ = try func .setBreakpoint (2 , true ); // Line 2: return 42
770770
771771 // Call the nested functions - this should hit the breakpoint
772772 const result = try lua .eval ("return outerFunc()" , .{}, i32 );
@@ -819,16 +819,15 @@ test "breakpoint and single step debugging with callbacks" {
819819
820820 // Get function reference
821821 const func = try lua .globals ().get ("test_func" , Lua .Function );
822- try expect (func != null );
823- defer func .? .deinit ();
822+ defer func .deinit ();
824823
825- const breakpoint_line = try func .? . setBreakpoint (4 , true );
824+ const breakpoint_line = try func .setBreakpoint (4 , true );
826825 try expectEqual (breakpoint_line , 5 );
827826
828827 lua .debug ().setSingleStep (true );
829828 lua .setCallbacks (& callbacks );
830829
831- const result = try func .? . call (.{}, i32 );
830+ const result = try func .call (.{}, i32 );
832831
833832 try expectEqual (result .ok , 60 );
834833 try expectEqual (callbacks .break_hits , 1 );
@@ -864,17 +863,17 @@ test "coroutine debug break" {
864863 , .{}, void );
865864
866865 const func = try thread .globals ().get ("test_func" , Lua .Function );
867- defer func .? . deinit ();
866+ defer func .deinit ();
868867
869- _ = try func .? . setBreakpoint (2 , true );
868+ _ = try func .setBreakpoint (2 , true );
870869
871- const first_result = try func .? . call (.{}, i32 );
870+ const first_result = try func .call (.{}, i32 );
872871 try expectEqual (first_result , .debugBreak );
873872
874873 try expectEqual (thread .status (), .normal );
875874
876875 // Call function again - should complete and return result
877- const second_result = try func .? . call (.{}, i32 );
876+ const second_result = try func .call (.{}, i32 );
878877 try expectEqual (second_result .ok , 42 );
879878
880879 // Assert debugbreak callback was called exactly twice
@@ -929,11 +928,11 @@ test "getInfo and stackDepth in debug breakpoint" {
929928
930929 // Get the function and set a breakpoint
931930 const func = try lua .globals ().get ("testFunction" , Lua .Function );
932- defer func .? . deinit ();
933- _ = try func .? . setBreakpoint (3 , true ); // Line 3: return x * 2
931+ defer func .deinit ();
932+ _ = try func .setBreakpoint (3 , true ); // Line 3: return x * 2
934933
935934 // Call the function - this should hit the breakpoint
936- const result = try func .? . call (.{ 5 , 10 }, i32 );
935+ const result = try func .call (.{ 5 , 10 }, i32 );
937936 try expectEqual (result .ok .? , 30 );
938937
939938 // Verify breakpoint was hit
@@ -955,7 +954,7 @@ test "getInfo outside of hook" {
955954 _ = try lua .eval (code , .{}, void );
956955
957956 // Get the function and execute it
958- const func = ( try lua .globals ().get ("testFunction" , Lua .Function )) .? ;
957+ const func = try lua .globals ().get ("testFunction" , Lua .Function );
959958 defer func .deinit ();
960959
961960 const result = try func .call (.{ 5 , 10 }, i32 );
@@ -1036,11 +1035,11 @@ test "getArg in debug breakpoint" {
10361035
10371036 // Get the function and set a breakpoint
10381037 const func = try lua .globals ().get ("testArguments" , Lua .Function );
1039- defer func .? . deinit ();
1040- _ = try func .? . setBreakpoint (3 , true ); // Line 3: return sum
1038+ defer func .deinit ();
1039+ _ = try func .setBreakpoint (3 , true ); // Line 3: return sum
10411040
10421041 // Call the function with known arguments - this should hit the breakpoint
1043- const result = try func .? . call (.{ 100 , 200 }, i32 );
1042+ const result = try func .call (.{ 100 , 200 }, i32 );
10441043 try expectEqual (result .ok .? , 300 );
10451044
10461045 // Verify breakpoint was hit and arguments were tested
@@ -1132,10 +1131,10 @@ test "getLocal and setLocal in debug breakpoint" {
11321131 }
11331132
11341133 const func = try lua .globals ().get ("testLocals" , Lua .Function );
1135- defer func .? . deinit ();
1136- _ = try func .? . setBreakpoint (5 , true ); // Line 5: return sum
1134+ defer func .deinit ();
1135+ _ = try func .setBreakpoint (5 , true ); // Line 5: return sum
11371136
1138- const call_result = try func .? . call (.{ 100 , 200 }, i32 );
1137+ const call_result = try func .call (.{ 100 , 200 }, i32 );
11391138 try expectEqual (call_result .ok .? , 400 );
11401139
11411140 try expect (LocalVariableTester .breakpoint_hit );
@@ -1227,13 +1226,13 @@ test "getUpvalue and setUpvalue in debug breakpoint" {
12271226 }
12281227
12291228 const func = try lua .globals ().get ("innerFunction" , Lua .Function );
1230- defer func .? . deinit ();
1229+ defer func .deinit ();
12311230
12321231 // Try line 3 (function start is line 2, line 3 is return)
1233- const actual_line = try func .? . setBreakpoint (3 , true );
1232+ const actual_line = try func .setBreakpoint (3 , true );
12341233 try expectEqual (actual_line , 3 );
12351234
1236- const call_result = try func .? . call (.{}, i32 );
1235+ const call_result = try func .call (.{}, i32 );
12371236 try expectEqual (call_result .ok .? , 1998 ); // 999 * 2 (modified upvalue)
12381237
12391238 try expect (UpvalueTester .breakpoint_hit );
@@ -1270,35 +1269,35 @@ test "high-level getUpvalue and setUpvalue API" {
12701269 }
12711270
12721271 const func = try lua .globals ().get ("closure" , Lua .Function );
1273- defer func .? . deinit ();
1272+ defer func .deinit ();
12741273
12751274 const debug = lua .debug ();
12761275
12771276 // Test getting upvalue using high-level API
1278- const upval1 = debug .getUpvalue (func .? , 1 , i32 );
1277+ const upval1 = debug .getUpvalue (func , 1 , i32 );
12791278 try expect (upval1 != null );
12801279 try expectEqual (upval1 .? .value , 42 );
12811280 try expect (std .mem .eql (u8 , upval1 .? .name , "shared_value" ));
12821281
12831282 // Test setting upvalue using high-level API
1284- const set_name = debug .setUpvalue (func .? , 1 , i32 , 100 );
1283+ const set_name = debug .setUpvalue (func , 1 , i32 , 100 );
12851284 try expect (set_name != null );
12861285 try expect (std .mem .eql (u8 , set_name .? , "shared_value" ));
12871286
12881287 // Verify the upvalue was changed
1289- const upval2 = debug .getUpvalue (func .? , 1 , i32 );
1288+ const upval2 = debug .getUpvalue (func , 1 , i32 );
12901289 try expect (upval2 != null );
12911290 try expectEqual (upval2 .? .value , 100 );
12921291
12931292 // Test the function returns the modified upvalue
1294- const call_result = try func .? . call (.{}, i32 );
1293+ const call_result = try func .call (.{}, i32 );
12951294 try expectEqual (call_result .ok .? , 100 );
12961295
12971296 // Test getting non-existent upvalue
1298- const upval_invalid = debug .getUpvalue (func .? , 10 , i32 );
1297+ const upval_invalid = debug .getUpvalue (func , 10 , i32 );
12991298 try expect (upval_invalid == null );
13001299
13011300 // Test setting non-existent upvalue
1302- const set_invalid = debug .setUpvalue (func .? , 10 , i32 , 42 );
1301+ const set_invalid = debug .setUpvalue (func , 10 , i32 , 42 );
13031302 try expect (set_invalid == null );
13041303}
0 commit comments