Determines whether an object is valid.
The object to check the validity of.
Returns TRUE if oObject is a valid object, otherwise FALSE.
This function is a widely used utility function to check the return values for functions that return objects. While looping through objects NWN functions usually return invalid objects to signify that there are no more objects left. This function can be used to test that condition.
Most of the time, this will be the same as comparing oObject to OBJECT_INVALID. There may be times where it isn't though, so it is generally recommended that you use this function.
Related discussion from #nwnx Discord
--HA-- Can there be a difference in result between comparing OBJECT_INVALID and calling GetIsObjectValid or would it always be a bit better to use OBJECT_INVALID?
clippy They are very different. object is actually a numerical ID of the object. OBJECT_INVALID is a numerical constant that objects will never have (0x7f000000). Comparing against OBJECT_INVALID is only comparing against that particular constant. GetIsObjectValid() actually tries to look up the object by ID and return whether or not it exists in the world. For example, if you do SetLocalObject(oModule, "someitem", oSomeItem), and then destroy that item..
So GetIsObjectValid() is always 'safer', but 'slower'
author: Tom Cassiotis, editor: Lilac Soul