#(hatzefatz) isList?

29 messages · Page 1 of 1 (latest)

cosmic dew
#

Is there a way to find out, if a flag is a list or map?

icy frostBOT
#

(hatzefatz) isList?

icy frostBOT
#

Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.

wooden mantle
#

!t objecttag.object_type

gentle whaleBOT
hearty archBOT
wooden mantle
#

oop

opaque hatch
#

!t alphabetical

gentle whaleBOT
opaque hatch
#

!t is_truthy

gentle whaleBOT
# opaque hatch !t is_truthy

Returns true if the object is 'truthy'. An object is 'truthy' if it exists and is valid, and does not represent a concept like emptiness.
An empty list or an air item will return 'false'. Plaintext "null" or "false", an empty element, or a numeric zero will return 'false' as well.
Some object types may have their own logical implementations, for examples an EntityTag value is 'truthy' only if the entity it represents is spawned.
Errored/broken/invalid tags are also considered 'false' by this log...

Returns

ElementTag(Boolean)

opaque hatch
# gentle whale

This tag is made available to help you debug script issues
not made for actual scripting

opaque hatch
# gentle whale

since this tag only exists for lists, if you use it in any other object aside from a list, it'll error

#

and is_truthy will catch that

#

so .alphabetical.is_truthy = "is_list"

wooden mantle
warm nymph
#

You could just do <[flag].as[list].exists> as well

#

But like, why do you need this?

#

You create/modify/remove your own flags, you should know what they are, is there anything specific you're trying to achieve?

spiral heath
#

when a features says that you shouldn't use it, what it generally means is that you shouldn't need to use it

#

If you feel like you need it, you have a design issue

#

to that end, just recreating it doesn't make a difference

#

If you are going to do it anyway, just use the easier tag

spiral heath
cosmic dew
#

I made a flag tool, to show flag status and so on. Now i want to display the list size, if it is a list.

Any idea, how that would work the best?
I Mean, .object_type should work.

loud pelican
# gentle whale

^ That counts as debugging, which is what the tag is meant for - it shouldn't be used in any real script as it's generally a sign of bad practice, but in this case you're outputting debug information

#

Although in this case it's probably a bit redundant, can just

- define size <[object].size.if_null[null]>
- if <[size]> != null:
  - narrate "Size: <[size]>"