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