fix effect_set_category#811
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a type mismatch issue in effect_set_category where the function parameter handling wasn't updated when effect->category was changed from uint32_t to uint64_t. The implementation now uses int64_t to receive the value from Lua, validates that it's non-negative, and then casts it to uint64_t before assignment.
Key Changes
- Changed parameter handling from
uint32_tcast toint64_twith validation - Added negative value check with error message
- Cast to
uint64_tfor assignment to match the field type
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
https://www.lua.org/manual/5.4/manual.html#lua_Integer typedef ... lua_Integer;The type of integers in Lua. By default this type is long long, (usually a 64-bit two-complement integer), but that can be changed to long or int (usually a 32-bit two-complement integer). (See LUA_INT_TYPE in luaconf.h.) Lua also defines the constants LUA_MININTEGER and LUA_MAXINTEGER, with the minimum and the maximum values that fit in this type.
|
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
effect->categorywas changed from uint32 to uint64 in #660 , buteffect_set_categorystill uses uint32.lua_Integerislong longand don't support uint64 fully.@salix5 should we simply use