-
-
Notifications
You must be signed in to change notification settings - Fork 290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix integer sizing in Enum #902
base: master
Are you sure you want to change the base?
Conversation
LuaJIT provides ability to do this, we have some converter for 64-bit values. They have to be suffixed, we have it hacked a bit that it creates specific lua string and executes it to get correct type. There is probably better way but this is what we have and do. |
ToLua conversion: CyberEngineTweaks/src/reverse/LuaRED.h Line 12 in 0544f6f
FromLua (ToRED) conversion: CyberEngineTweaks/src/reverse/LuaRED.h Line 41 in 0544f6f
|
If it doesnt work for some reason, it should be looked at, we need to be able to work with 64 bit numbers from Lua in some way. If on the Lua side you tried to just put some big number, try to add that ll/ull suffix. If this fails getting to Lua properly, I would have a look if it doesn't fail to convert properly, but I would guess this is called somewhere down the line and it should work, that it is a suffix issue on Lua side (you didn't include it so it didnt know what to do). |
I did not have a look at the changes btw, would like to do so later... Think this needs thorough look, need to make sure you do static conversions correctly (that may be the biggest issue with such solution). Just skimmed through it, saw some safe sets/gets... Just reacting to what you wrote now more or less, dont take it as a review :P |
Appending |
Fixes #888.
Pretty straightforward changes - mainly just converted
Enum.m_value
to a union and wrote conversions where needed. Important bits:int32_t
which theoretically isn't wide enough, but they're currently only called using numbers from Lua which aren't precise enough either. Could be fixed, but a cursory scan didn't turn up anything currently in the game that's large enough to need more than an int32, so I didn't worry about itEnumInt
function exposed to Lua to return a correctly sized int. This isn't strictly necessary and it could just be an Int64 if that's preferredEnum
constructors work correctly from LuaLet me know if there's any changes I need to make or other information you need!