Adds functions to several userdata objects, to make it possible to check what kind of userdata object they are.
The intended use is to always call the global GetUserdataType function, instead of calling the various userdata objects' GetUserdataType functions; since a userdata object is not guaranteed to have a GetUserdataType function defined.
This PR will allow #205 to distinguish between SpaceDamage and SkillEffect objects in order to dispatch the appropriate events.
This might not be an exhaustive list of userdata types, so feel free to add to the list.
userdata
This page describes helper functions for userdata objects that have been added as part of modding API.
Adds functions to several userdata objects, to make it possible to check what kind of userdata object they are. The intended use is to always call the global
GetUserdataType
function, instead of calling the various userdata objects' GetUserdataType functions; since a userdata object is not guaranteed to have a GetUserdataType function defined.This PR will allow #205 to distinguish between SpaceDamage and SkillEffect objects in order to dispatch the appropriate events.
This might not be an exhaustive list of userdata types, so feel free to add to the list.
userdata
This page describes helper functions for
userdata
objects that have been added as part of modding API.GetUserdataType
userdata
returns a string of the userdata type of the specified userdata, or "Unknown", if the userdata does not have a
GetUserdataType
function.modApi.isUserdataClass
userdata
returns
true
if the userdata object is a class, otherwise,false
.modApi.isUserdataInstance
userdata
returns
true
if the userdata object is an instance of a class, otherwise,false
.Game:GetUserdataType
returns
"Game"
Board:GetUserdataType
returns
"Board"
Pawn:GetUserdataType
returns
"Pawn"
PAWN_FACTORY:GetUserdataType
returns
"PAWN_FACTORY"
Point:GetUserdataType
returns
"Point"
if it is a class instance, or"PointClass"
if it is the Point class itself.SkillEffect:GetUserdataType
returns
"SkillEffect"
if it is a class instance, or"SkillEffectClass"
if it is the SkillEffect class itself.SpaceDamage:GetUserdataType
returns
"SpaceDamage"
if it is a class instance, or"SpaceDamageClass"
if it is the SpaceDamage class itself.