Possible issue with readytime_v?

All discussions & material related to Command's Lua interface

Moderators: RoryAndersonCDT, michaelm75au, angster, MOD_Command

Post Reply
LettuceTurnipTheBeet
Posts: 10
Joined: Sat Dec 18, 2021 12:09 pm

Possible issue with readytime_v?

Post 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
 
KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

RE: Possible issue with readytime_v?

Post 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.





Post Reply

Return to “Lua Legion”