hyTags
HomeHome DocumentationDocumentation

object-get

Gets the value associated with the specified key from the object.
Parameter
Type
Description
self
Object
The object to get the value from.
key
String
The key to look up in the object.
type
Type
The expected type of the value.
return
T
The value associated with the key, or nil if the key does not exist.
Test Case:Get existing key
    <div></div>
    
    <object-new>
    <object-set key="name">
      <string-new value="test">
    </object-set>
    <object-get key="name" type="string">
    <assert-equal value="test" type="string">
    
    👆 Try to change something!
  • Test Case:Get non-existing key returns nil
      <div></div>
      
      <object-new>
      <object-get key="missing" type="string">
      <value-is-nil>
      <assert-true>
      
      👆 Try to change something!
    • Test succeeded Test failed