Lua Contact Wrapper .fromside object not set exception (Full Version)

All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Tech Support



Message


KnightHawk75 -> Lua Contact Wrapper .fromside object not set exception (12/9/2021 11:25:48 PM)

Lua - Contact Wrapper .fromside edgy case generates exception instead of expected nil.

On the Contact wrapper, if you access .fromside and the fromSidePerspective side is nil, like is the case when using VP_GetContact(), it'll throw an exception error instead of coming back nil. Seems we may need a check first to just return nil if fromSidePerspective is null before trying to generate the LuaWrapper_Side. No issue with SE_GetContact, since there the side perspective is always given, or handled if the user forgets to provide it.
Why would one call .fromside on a VP_Contact generated contact? I wouldn't, but in cases where you might not know it was VP_ that generated the contact in question it can happen.

Repo:
Load attached scene. Open Lua console.
Run this:
local c = VP_GetContact({guid='GWKW9V-0HMDN54K78NV9'})
print(c.side); --returns expected nil (no detection yet)
print(c.fromside); --object not set to instance exception; Expected return of nil.
print(c.detectedBySide.name); --never gets here but would succeed if it could. 






Deserere -> RE: Lua Contact Wrapper .fromside object not set exception (1/20/2022 10:32:19 AM)

thanks for the detailed explanation.
The issue is fixed and will be in the next update release




KnightHawk75 -> RE: Lua Contact Wrapper .fromside object not set exception (1/21/2022 9:40:06 AM)

Thanks!




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.765625