GetObjectType usage

Discuss any general programming issues here
Post Reply
sashapont
Posts: 131
Joined: Thu Aug 03, 2017 2:49 pm

GetObjectType usage

Post by sashapont » Mon Oct 28, 2019 8:22 pm

Please explain me how I can use this function

TextOut(10, 10,"a" ,{name= text1,Color=#Black})

how I can get type of this object?

type = GetObjectType("text1")

is not work...

PEB
Posts: 259
Joined: Sun Feb 21, 2010 1:28 am

Re: GetObjectType usage

Post by PEB » Tue Oct 29, 2019 1:01 am

There is no reason to use GetObjectType() at all with your example.

The purpose of GetObjectType() is to return the type of object that is associated with a custom #LIGHTUSERDATA identifier (created by using Hollywood's Automatic ID selection).

In your example, you are assigning a layer name (which always needs to be a string). Layers are the only objects that can have #STRING names. So if you use your example:
TextOut(10, 10,"a", {name="text1", Color=#Black})

...you now have a layer with the name "text1".

If you want to know what type of layer "text1" is, then GetAttribute(#LAYER, "text1", #ATTRTYPE) will give you that information.

Post Reply