User Tools

Site Tools


modding:function:typdynamicunid

Talk Page

typDynamicUNID

Syntax (typDynamicUNID uniqueName) → UNID
Arguments uniqueName: A string that represents the UNID to return. Must be at least one character long.
Returns A UNID between 0xF0000000 and 0xFFFFFFFF. If the string has not been bound to any UNID, then the function will return a new UNID and bind the string to it. Otherwise, it will return the UNID that was bound to the name.
Category type_functions, unid_functions
Description Binds a string to a UNID in the 0xF0000000 range. The UNID can then be bound to a dynamic type. UNIDs start at 0xF0000000 and increment up whenever a new name is assigned. Use this function with typCreate to handle UNID assignment and prevent conflicts with existing types.

Example

(enum (list "type1" "type2" "type3" "type2" "type2" "type4" "type5") theName
	(print (typDynamicUNID theName))
	)

<!--
Assuming that a new vanilla game has just started, the above code will print the following:
-268435456
-268435455
-268435454
-268435455
-268435455
-268435453
-268435452
-->

Return to type functions list

Return to Functions list

modding/function/typdynamicunid.txt · Last modified: 2017/06/12 01:07 by 0xabcdef