Skip to content

Commit ec63104

Browse files
Copilotkunitoki
andauthored
Remove lua_isinteger strict integer check to avoid version-dependent behavior
Agent-Logs-Url: https://github.com/kunitoki/LuaBridge3/sessions/b1763436-44f6-43de-ae63-34f98302e8aa Co-authored-by: kunitoki <707032+kunitoki@users.noreply.github.com>
1 parent d1c0d08 commit ec63104

2 files changed

Lines changed: 0 additions & 130 deletions

File tree

‎Distribution/LuaBridge/LuaBridge.h‎

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -4094,11 +4094,6 @@ struct Stack<std::byte>
40944094
if (lua_type(L, index) != LUA_TNUMBER)
40954095
return makeErrorCode(ErrorCode::InvalidTypeCast);
40964096

4097-
#if LUABRIDGE_STRICT_STACK_CONVERSIONS && LUA_VERSION_NUM >= 503
4098-
if (! lua_isinteger(L, index))
4099-
return makeErrorCode(ErrorCode::InvalidTypeCast);
4100-
#endif
4101-
41024097
if (! is_integral_representable_by<unsigned char>(L, index))
41034098
return makeErrorCode(ErrorCode::IntegerDoesntFitIntoLuaInteger);
41044099

@@ -4177,11 +4172,6 @@ struct Stack<int8_t>
41774172
if (lua_type(L, index) != LUA_TNUMBER)
41784173
return makeErrorCode(ErrorCode::InvalidTypeCast);
41794174

4180-
#if LUABRIDGE_STRICT_STACK_CONVERSIONS && LUA_VERSION_NUM >= 503
4181-
if (! lua_isinteger(L, index))
4182-
return makeErrorCode(ErrorCode::InvalidTypeCast);
4183-
#endif
4184-
41854175
if (! is_integral_representable_by<int8_t>(L, index))
41864176
return makeErrorCode(ErrorCode::IntegerDoesntFitIntoLuaInteger);
41874177

@@ -4219,11 +4209,6 @@ struct Stack<unsigned char>
42194209
if (lua_type(L, index) != LUA_TNUMBER)
42204210
return makeErrorCode(ErrorCode::InvalidTypeCast);
42214211

4222-
#if LUABRIDGE_STRICT_STACK_CONVERSIONS && LUA_VERSION_NUM >= 503
4223-
if (! lua_isinteger(L, index))
4224-
return makeErrorCode(ErrorCode::InvalidTypeCast);
4225-
#endif
4226-
42274212
if (! is_integral_representable_by<unsigned char>(L, index))
42284213
return makeErrorCode(ErrorCode::IntegerDoesntFitIntoLuaInteger);
42294214

@@ -4260,11 +4245,6 @@ struct Stack<short>
42604245
if (lua_type(L, index) != LUA_TNUMBER)
42614246
return makeErrorCode(ErrorCode::InvalidTypeCast);
42624247

4263-
#if LUABRIDGE_STRICT_STACK_CONVERSIONS && LUA_VERSION_NUM >= 503
4264-
if (! lua_isinteger(L, index))
4265-
return makeErrorCode(ErrorCode::InvalidTypeCast);
4266-
#endif
4267-
42684248
if (! is_integral_representable_by<short>(L, index))
42694249
return makeErrorCode(ErrorCode::IntegerDoesntFitIntoLuaInteger);
42704250

@@ -4301,11 +4281,6 @@ struct Stack<unsigned short>
43014281
if (lua_type(L, index) != LUA_TNUMBER)
43024282
return makeErrorCode(ErrorCode::InvalidTypeCast);
43034283

4304-
#if LUABRIDGE_STRICT_STACK_CONVERSIONS && LUA_VERSION_NUM >= 503
4305-
if (! lua_isinteger(L, index))
4306-
return makeErrorCode(ErrorCode::InvalidTypeCast);
4307-
#endif
4308-
43094284
if (! is_integral_representable_by<unsigned short>(L, index))
43104285
return makeErrorCode(ErrorCode::IntegerDoesntFitIntoLuaInteger);
43114286

@@ -4343,11 +4318,6 @@ struct Stack<int>
43434318
if (lua_type(L, index) != LUA_TNUMBER)
43444319
return makeErrorCode(ErrorCode::InvalidTypeCast);
43454320

4346-
#if LUABRIDGE_STRICT_STACK_CONVERSIONS && LUA_VERSION_NUM >= 503
4347-
if (! lua_isinteger(L, index))
4348-
return makeErrorCode(ErrorCode::InvalidTypeCast);
4349-
#endif
4350-
43514321
if (! is_integral_representable_by<int>(L, index))
43524322
return makeErrorCode(ErrorCode::IntegerDoesntFitIntoLuaInteger);
43534323

@@ -4385,11 +4355,6 @@ struct Stack<unsigned int>
43854355
if (lua_type(L, index) != LUA_TNUMBER)
43864356
return makeErrorCode(ErrorCode::InvalidTypeCast);
43874357

4388-
#if LUABRIDGE_STRICT_STACK_CONVERSIONS && LUA_VERSION_NUM >= 503
4389-
if (! lua_isinteger(L, index))
4390-
return makeErrorCode(ErrorCode::InvalidTypeCast);
4391-
#endif
4392-
43934358
if (! is_integral_representable_by<unsigned int>(L, index))
43944359
return makeErrorCode(ErrorCode::IntegerDoesntFitIntoLuaInteger);
43954360

@@ -4427,11 +4392,6 @@ struct Stack<long>
44274392
if (lua_type(L, index) != LUA_TNUMBER)
44284393
return makeErrorCode(ErrorCode::InvalidTypeCast);
44294394

4430-
#if LUABRIDGE_STRICT_STACK_CONVERSIONS && LUA_VERSION_NUM >= 503
4431-
if (! lua_isinteger(L, index))
4432-
return makeErrorCode(ErrorCode::InvalidTypeCast);
4433-
#endif
4434-
44354395
if (! is_integral_representable_by<long>(L, index))
44364396
return makeErrorCode(ErrorCode::IntegerDoesntFitIntoLuaInteger);
44374397

@@ -4469,11 +4429,6 @@ struct Stack<unsigned long>
44694429
if (lua_type(L, index) != LUA_TNUMBER)
44704430
return makeErrorCode(ErrorCode::InvalidTypeCast);
44714431

4472-
#if LUABRIDGE_STRICT_STACK_CONVERSIONS && LUA_VERSION_NUM >= 503
4473-
if (! lua_isinteger(L, index))
4474-
return makeErrorCode(ErrorCode::InvalidTypeCast);
4475-
#endif
4476-
44774432
if (! is_integral_representable_by<unsigned long>(L, index))
44784433
return makeErrorCode(ErrorCode::IntegerDoesntFitIntoLuaInteger);
44794434

@@ -4511,11 +4466,6 @@ struct Stack<long long>
45114466
if (lua_type(L, index) != LUA_TNUMBER)
45124467
return makeErrorCode(ErrorCode::InvalidTypeCast);
45134468

4514-
#if LUABRIDGE_STRICT_STACK_CONVERSIONS && LUA_VERSION_NUM >= 503
4515-
if (! lua_isinteger(L, index))
4516-
return makeErrorCode(ErrorCode::InvalidTypeCast);
4517-
#endif
4518-
45194469
if (! is_integral_representable_by<long long>(L, index))
45204470
return makeErrorCode(ErrorCode::IntegerDoesntFitIntoLuaInteger);
45214471

@@ -4553,11 +4503,6 @@ struct Stack<unsigned long long>
45534503
if (lua_type(L, index) != LUA_TNUMBER)
45544504
return makeErrorCode(ErrorCode::InvalidTypeCast);
45554505

4556-
#if LUABRIDGE_STRICT_STACK_CONVERSIONS && LUA_VERSION_NUM >= 503
4557-
if (! lua_isinteger(L, index))
4558-
return makeErrorCode(ErrorCode::InvalidTypeCast);
4559-
#endif
4560-
45614506
if (! is_integral_representable_by<unsigned long long>(L, index))
45624507
return makeErrorCode(ErrorCode::IntegerDoesntFitIntoLuaInteger);
45634508

@@ -4597,11 +4542,6 @@ struct Stack<__int128_t>
45974542
if (lua_type(L, index) != LUA_TNUMBER)
45984543
return makeErrorCode(ErrorCode::InvalidTypeCast);
45994544

4600-
#if LUABRIDGE_STRICT_STACK_CONVERSIONS && LUA_VERSION_NUM >= 503
4601-
if (! lua_isinteger(L, index))
4602-
return makeErrorCode(ErrorCode::InvalidTypeCast);
4603-
#endif
4604-
46054545
if (! is_integral_representable_by<__int128_t>(L, index))
46064546
return makeErrorCode(ErrorCode::IntegerDoesntFitIntoLuaInteger);
46074547

@@ -4639,11 +4579,6 @@ struct Stack<__uint128_t>
46394579
if (lua_type(L, index) != LUA_TNUMBER)
46404580
return makeErrorCode(ErrorCode::InvalidTypeCast);
46414581

4642-
#if LUABRIDGE_STRICT_STACK_CONVERSIONS && LUA_VERSION_NUM >= 503
4643-
if (! lua_isinteger(L, index))
4644-
return makeErrorCode(ErrorCode::InvalidTypeCast);
4645-
#endif
4646-
46474582
if (! is_integral_representable_by<__uint128_t>(L, index))
46484583
return makeErrorCode(ErrorCode::IntegerDoesntFitIntoLuaInteger);
46494584

‎Source/LuaBridge/detail/Stack.h‎

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,6 @@ struct Stack<std::byte>
215215
if (lua_type(L, index) != LUA_TNUMBER)
216216
return makeErrorCode(ErrorCode::InvalidTypeCast);
217217

218-
#if LUABRIDGE_STRICT_STACK_CONVERSIONS && LUA_VERSION_NUM >= 503
219-
if (! lua_isinteger(L, index))
220-
return makeErrorCode(ErrorCode::InvalidTypeCast);
221-
#endif
222-
223218
if (! is_integral_representable_by<unsigned char>(L, index))
224219
return makeErrorCode(ErrorCode::IntegerDoesntFitIntoLuaInteger);
225220

@@ -306,11 +301,6 @@ struct Stack<int8_t>
306301
if (lua_type(L, index) != LUA_TNUMBER)
307302
return makeErrorCode(ErrorCode::InvalidTypeCast);
308303

309-
#if LUABRIDGE_STRICT_STACK_CONVERSIONS && LUA_VERSION_NUM >= 503
310-
if (! lua_isinteger(L, index))
311-
return makeErrorCode(ErrorCode::InvalidTypeCast);
312-
#endif
313-
314304
if (! is_integral_representable_by<int8_t>(L, index))
315305
return makeErrorCode(ErrorCode::IntegerDoesntFitIntoLuaInteger);
316306

@@ -352,11 +342,6 @@ struct Stack<unsigned char>
352342
if (lua_type(L, index) != LUA_TNUMBER)
353343
return makeErrorCode(ErrorCode::InvalidTypeCast);
354344

355-
#if LUABRIDGE_STRICT_STACK_CONVERSIONS && LUA_VERSION_NUM >= 503
356-
if (! lua_isinteger(L, index))
357-
return makeErrorCode(ErrorCode::InvalidTypeCast);
358-
#endif
359-
360345
if (! is_integral_representable_by<unsigned char>(L, index))
361346
return makeErrorCode(ErrorCode::IntegerDoesntFitIntoLuaInteger);
362347

@@ -397,11 +382,6 @@ struct Stack<short>
397382
if (lua_type(L, index) != LUA_TNUMBER)
398383
return makeErrorCode(ErrorCode::InvalidTypeCast);
399384

400-
#if LUABRIDGE_STRICT_STACK_CONVERSIONS && LUA_VERSION_NUM >= 503
401-
if (! lua_isinteger(L, index))
402-
return makeErrorCode(ErrorCode::InvalidTypeCast);
403-
#endif
404-
405385
if (! is_integral_representable_by<short>(L, index))
406386
return makeErrorCode(ErrorCode::IntegerDoesntFitIntoLuaInteger);
407387

@@ -442,11 +422,6 @@ struct Stack<unsigned short>
442422
if (lua_type(L, index) != LUA_TNUMBER)
443423
return makeErrorCode(ErrorCode::InvalidTypeCast);
444424

445-
#if LUABRIDGE_STRICT_STACK_CONVERSIONS && LUA_VERSION_NUM >= 503
446-
if (! lua_isinteger(L, index))
447-
return makeErrorCode(ErrorCode::InvalidTypeCast);
448-
#endif
449-
450425
if (! is_integral_representable_by<unsigned short>(L, index))
451426
return makeErrorCode(ErrorCode::IntegerDoesntFitIntoLuaInteger);
452427

@@ -488,11 +463,6 @@ struct Stack<int>
488463
if (lua_type(L, index) != LUA_TNUMBER)
489464
return makeErrorCode(ErrorCode::InvalidTypeCast);
490465

491-
#if LUABRIDGE_STRICT_STACK_CONVERSIONS && LUA_VERSION_NUM >= 503
492-
if (! lua_isinteger(L, index))
493-
return makeErrorCode(ErrorCode::InvalidTypeCast);
494-
#endif
495-
496466
if (! is_integral_representable_by<int>(L, index))
497467
return makeErrorCode(ErrorCode::IntegerDoesntFitIntoLuaInteger);
498468

@@ -534,11 +504,6 @@ struct Stack<unsigned int>
534504
if (lua_type(L, index) != LUA_TNUMBER)
535505
return makeErrorCode(ErrorCode::InvalidTypeCast);
536506

537-
#if LUABRIDGE_STRICT_STACK_CONVERSIONS && LUA_VERSION_NUM >= 503
538-
if (! lua_isinteger(L, index))
539-
return makeErrorCode(ErrorCode::InvalidTypeCast);
540-
#endif
541-
542507
if (! is_integral_representable_by<unsigned int>(L, index))
543508
return makeErrorCode(ErrorCode::IntegerDoesntFitIntoLuaInteger);
544509

@@ -580,11 +545,6 @@ struct Stack<long>
580545
if (lua_type(L, index) != LUA_TNUMBER)
581546
return makeErrorCode(ErrorCode::InvalidTypeCast);
582547

583-
#if LUABRIDGE_STRICT_STACK_CONVERSIONS && LUA_VERSION_NUM >= 503
584-
if (! lua_isinteger(L, index))
585-
return makeErrorCode(ErrorCode::InvalidTypeCast);
586-
#endif
587-
588548
if (! is_integral_representable_by<long>(L, index))
589549
return makeErrorCode(ErrorCode::IntegerDoesntFitIntoLuaInteger);
590550

@@ -626,11 +586,6 @@ struct Stack<unsigned long>
626586
if (lua_type(L, index) != LUA_TNUMBER)
627587
return makeErrorCode(ErrorCode::InvalidTypeCast);
628588

629-
#if LUABRIDGE_STRICT_STACK_CONVERSIONS && LUA_VERSION_NUM >= 503
630-
if (! lua_isinteger(L, index))
631-
return makeErrorCode(ErrorCode::InvalidTypeCast);
632-
#endif
633-
634589
if (! is_integral_representable_by<unsigned long>(L, index))
635590
return makeErrorCode(ErrorCode::IntegerDoesntFitIntoLuaInteger);
636591

@@ -672,11 +627,6 @@ struct Stack<long long>
672627
if (lua_type(L, index) != LUA_TNUMBER)
673628
return makeErrorCode(ErrorCode::InvalidTypeCast);
674629

675-
#if LUABRIDGE_STRICT_STACK_CONVERSIONS && LUA_VERSION_NUM >= 503
676-
if (! lua_isinteger(L, index))
677-
return makeErrorCode(ErrorCode::InvalidTypeCast);
678-
#endif
679-
680630
if (! is_integral_representable_by<long long>(L, index))
681631
return makeErrorCode(ErrorCode::IntegerDoesntFitIntoLuaInteger);
682632

@@ -718,11 +668,6 @@ struct Stack<unsigned long long>
718668
if (lua_type(L, index) != LUA_TNUMBER)
719669
return makeErrorCode(ErrorCode::InvalidTypeCast);
720670

721-
#if LUABRIDGE_STRICT_STACK_CONVERSIONS && LUA_VERSION_NUM >= 503
722-
if (! lua_isinteger(L, index))
723-
return makeErrorCode(ErrorCode::InvalidTypeCast);
724-
#endif
725-
726671
if (! is_integral_representable_by<unsigned long long>(L, index))
727672
return makeErrorCode(ErrorCode::IntegerDoesntFitIntoLuaInteger);
728673

@@ -765,11 +710,6 @@ struct Stack<__int128_t>
765710
if (lua_type(L, index) != LUA_TNUMBER)
766711
return makeErrorCode(ErrorCode::InvalidTypeCast);
767712

768-
#if LUABRIDGE_STRICT_STACK_CONVERSIONS && LUA_VERSION_NUM >= 503
769-
if (! lua_isinteger(L, index))
770-
return makeErrorCode(ErrorCode::InvalidTypeCast);
771-
#endif
772-
773713
if (! is_integral_representable_by<__int128_t>(L, index))
774714
return makeErrorCode(ErrorCode::IntegerDoesntFitIntoLuaInteger);
775715

@@ -811,11 +751,6 @@ struct Stack<__uint128_t>
811751
if (lua_type(L, index) != LUA_TNUMBER)
812752
return makeErrorCode(ErrorCode::InvalidTypeCast);
813753

814-
#if LUABRIDGE_STRICT_STACK_CONVERSIONS && LUA_VERSION_NUM >= 503
815-
if (! lua_isinteger(L, index))
816-
return makeErrorCode(ErrorCode::InvalidTypeCast);
817-
#endif
818-
819754
if (! is_integral_representable_by<__uint128_t>(L, index))
820755
return makeErrorCode(ErrorCode::IntegerDoesntFitIntoLuaInteger);
821756

0 commit comments

Comments
 (0)