From JC2-MP Documentation
Server and client
|Description||Returns true if object exists.|
|Prototype||IsValid(object object, boolean)|
|Description||Returns true if object exists. The boolean is whether to check if the object is also streamed in (near the local player). Default is true.|
A common use of this function is to make sure Player references are still around. For instance, if you store a Player somewhere and they disconnect, you still have that Player variable. If you try to call functions on it, you will get a null reference error. You can use IsValid to determine if your Player variable is still good or not.
Simple test to see if the default world is valid.
print(IsValid(DefaultWorld)) --> true
- Works for all types.
- Returns false if the argument is nil.
- Types that can become invalid references:
- GWEN classes