hyTags
HomeHome DocumentationDocumentation

value-get

Retrieves a value from the stack without removing it. Useful in a scoped context to pull a stack value to the current top level stack.
Parameter
Type
Description
type
Type?
The type of value to get. If not specified, gets any value.
return
T
The value from the stack, or nil if not found
Test Case:Get value returns value without removing
    <div></div>
    
    <string-new value="first">
    <string-new value="second">
    <value-get type="string">
    <assert-equal value="second" type="string">
    <value-drop type="string">
    <value-drop type="string">
    <assert-equal value="first" type="string">
    
    👆 Try to change something!
  • Test Case:Get with type finds matching value
      <div></div>
      
      <number-new value="42">
      <string-new value="hello">
      <value-get type="number">
      <assert-equal value="42" type="number">
      
      👆 Try to change something!
    • Test succeeded Test failed