Page 1 of 1

Possible issue with readytime_v?

Posted: Sun Jan 02, 2022 4:37 pm
by LettuceTurnipTheBeet
I noticed a certain issue with the recently added return value readytime_v which is supposed to return the time to ready a loadout in seconds. When used on an unit accessed with ScenEdit_GetUnit(), it works properly, but when applied to an unit resolved with VP_GetUnit(), it returns KeraLua. LuaFunction. Is this a bug or stemming from my lack of understanding of difference between the two methods? A variable added in the same update, aibornetime_v works properly for both functions.

Code: Select all

 Lua version: Lua 5.3
 >> print(ScenEdit_GetUnit({name='F-15C Eagle', guid='RZD6HZ-0HMED50S0BD0F'}).readytime_v)
 0
 >> print(VP_GetUnit({name='F-15C Eagle', guid='RZD6HZ-0HMED50S0BD0F'}).readytime_v)
 KeraLua.LuaFunction
 >> print(ScenEdit_GetUnit({name='F-15C Eagle', guid='RZD6HZ-0HMED50S0BD0F'}).airbornetime_v)
 27
 >> print(VP_GetUnit({name='F-15C Eagle', guid='RZD6HZ-0HMED50S0BD0F'}).airbornetime_v)
 27
 

RE: Possible issue with readytime_v?

Posted: Thu Jan 06, 2022 7:29 pm
by KnightHawk75
I can say that VP_GetUnit() returns an ActiveUnit wrapper.
SE_GetUnit() returns an ActiveUnit_SE wrapper. An ActiveUnit_SE wrapper object contains readytime_v, ActiveUnit at present does not contain this property. So that's likely where the issue you experience comes from. airborntime_v on the other hand is contained in an ActiveUnit.

Reason the later works in either case is probably because as I recall GetUnit constructs it's returned ActiveUnit_SE off the base of an ActiveUnit. As for if readytime_v should actually be in ActiveUnit and not ActiveUnit_SE I couldn't really say and is one for Michael or the other devs.