API UO ApiNameExists en - LIHACHTETAN/ClassicUO-BadNewbie-BasicIDE GitHub Wiki
UO.ApiNameExists
ClassicUO • Runtime API
Tests whether a native callable name is registered.
Exact syntax
UO.ApiNameExists(name:String) -> Integer
Parameters
name— Required String: exact registered name, not a call expression. Case and outer spaces are ignored; UO. is never added automatically. Empty or unknown names return 0. User procedures are not included.
Returns
Integer 1 if the registration exists, otherwise 0. You may compare with TRUE/FALSE or 1/0. This does not confirm a game object, successful action or server permission.
Behavior
- Names are case-insensitive. InjectionApi registers the bare Basic library; InjectionApiUO registers game calls with UO. The analyzer reports SC005 for a removed short call and suggests a registered UO. replacement. No fallback executes that old call. Character getter values also require UO. ApiNameExists, ApiSignatureExists and ApiParameterExists trim surrounding spaces and check the exact registered name without adding a prefix. They inspect metadata, not server state. The engine does not implement the VB.NET reflection operator GetType(TypeName).
Examples
UO.ApiNameExists — 1
# UO.ApiNameExists — 1
#
# Tests whether a native callable name is registered.
#
# Integer 1 if the registration exists, otherwise 0. You may compare with TRUE/FALSE or 1/0.
# This does not confirm a game object, successful action or server permission.
SUB Main()
# The first example checks an explicitly qualified game API name and returns 1. The exact
# queried name and argument count, when needed, are visible in the call.
RETURN UO.ApiNameExists('UO.GetType')
END SUB
Parameter and execution notes:
- The first example checks an explicitly qualified game API name and returns 1. The exact queried name and argument count, when needed, are visible in the call.
UO.ApiNameExists — 2
# UO.ApiNameExists — 2
#
# Tests whether a native callable name is registered.
#
# Integer 1 if the registration exists, otherwise 0. You may compare with TRUE/FALSE or 1/0.
# This does not confirm a game object, successful action or server permission.
SUB Main()
# The second example checks Basic or a retained argument selector. Int(value) exists, Int() does
# not; backpack is a selector. The script returns 1 or "1:0" as shown by its calls.
VAR name = 'CInt'
RETURN UO.ApiNameExists(name)
END SUB
Parameter and execution notes:
- The second example checks Basic or a retained argument selector. Int(value) exists, Int() does not; backpack is a selector. The script returns 1 or "1:0" as shown by its calls.
UO.ApiNameExists — 3
# UO.ApiNameExists — 3
#
# Tests whether a native callable name is registered.
#
# Integer 1 if the registration exists, otherwise 0. You may compare with TRUE/FALSE or 1/0.
# This does not confirm a game object, successful action or server permission.
SUB Main()
# The third example defines the helper completely. It compares a removed short form or
# unsupported arity with a supported form. Parameters name, first, second and count pass the
# queried names/count unchanged. The result is 0 for the callable checks and "0:1" for the value
# check.
RETURN HasBoth('GetType','UO.GetType')
END SUB
FUNCTION HasBoth(first,second)
RETURN UO.ApiNameExists(first) AndAlso UO.ApiNameExists(second)
END FUNCTION
Parameter and execution notes:
- The third example defines the helper completely. It compares a removed short form or unsupported arity with a supported form. Parameters name, first, second and count pass the queried names/count unchanged. The result is 0 for the callable checks and "0:1" for the value check.