fun with type data

This is a moderated forum that collects tutorials, guides, and references for creating Transcendence extensions and scripts.
Post Reply
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

There are many type data functions in Transcendence and today we are going to look at them.

They are broken up into two categories each with three subcategories. The two categories are the gets and the sets. Each of those has three subcategories specific, global, and static.

The difference between get and set is pretty straightforward. The get functions get a value from the type data and the set functions set a value to the type data.

The difference between the three subcategories are a little more nuanced. Specific functions act on single thing. (items are an exception to this)
Global functions act on types. For example you can store data in the Sapphire class and all Sapphires will share that data.
Static functions act on xml stored information. So if you put something in the xml for the sapphire in the static data tag you can get it with a static function. There are no sets for static functions.

get-specific functions

objGetData
sysGetData
itmGetData

get-global functions

objGetGlobalData
typGetGlobalData
itmGetGlobalData

get-static functions

objGetStaticData
typGetStaticData
itmGetStaticData

set-specific functions

objSetData
sysSetData
itmSetData (see note)

set-global functions

objSetGlobalData
typSetGlobalData
itmSetGlobalData

One that doesn't act like the others is itmSetData. While the other sets can set things itmSetData returns an item struct that has the data changed. The original is not changed.

All type data is always valid. That means you can make up any named data you want and it will already exist. The default of type data is nil. This means that there is no difference between a type data that has been set to nil and one that hasn't been created.

To avoid trouble for now I would just use itmSetGlobalData instead of itmSetData. All you have to do is think up a naming scheme so you can tell items apart.
Crying is not a proper retort!
Post Reply