Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Lua Contact Wrapper .fromside object not set exception

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Tech Support >> Lua Contact Wrapper .fromside object not set exception Page: [1]
Login
Message << Older Topic   Newer Topic >>
Lua Contact Wrapper .fromside object not set exception - 12/9/2021 11:25:48 PM   
KnightHawk75

 

Posts: 1450
Joined: 11/15/2018
Status: offline
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. 




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

 

Posts: 36
Joined: 10/13/2021
Status: offline
thanks for the detailed explanation.
The issue is fixed and will be in the next update release

_____________________________

Si Spiritus pro nobis, quis contra nos?

(in reply to KnightHawk75)
Post #: 2
RE: Lua Contact Wrapper .fromside object not set exception - 1/21/2022 9:40:06 AM   
KnightHawk75

 

Posts: 1450
Joined: 11/15/2018
Status: offline
Thanks!

(in reply to Deserere)
Post #: 3
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Tech Support >> Lua Contact Wrapper .fromside object not set exception Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.656