GOLF(2gg)

πŸ“¦ version 601.4.41, in ubuntu questing

πŸ’– GOLF(2gg) β€” the new-message page, bestie edition πŸ’–

okay so we're in the GOLF manual, section 2gg, and this one's filed under Development. it's a whole lil baby page about making messages. slay. let's go πŸŽ€


✨ NAME ✨

new-message β€” (messages)

🌸 PURPOSE 🌸

create a new message. that's it. that's the job. iconic behavior honestly πŸ‘‘

πŸ¦‹ SYNTAX πŸ¦‹

new-message <message> [ from <string> ]

πŸ’… DESCRIPTION πŸ’…

so new-message is gonna create a new <message> object. brand new. fresh out the box. no cap.

now here's the tea β˜• β€” if you pass a <string> (that's the "from" clause, bestie), then it gets used to build the <message> out of it. and important: that <string> has to be in SEMI format. it could come from the request's input, from get-message, from reading a file, wherever β€” all valid sources, we're not picky about the origin story. BUT β€” and this is the plot twist β€” in that case, <message> can only be read from, using read-message. that's it. that's the whole vibe. you can't write to it, you read it. periodt.

if you run new-message without the "from" clause? then you're in build-it-yourself mode, and you can add data to <message> with write-message. so cute, so DIY, we love a craft project 🧚

🌈 EXAMPLES 🌈

okay here's the moment you've all been waiting for, the main character energy example ✨

begin-handler /msg public
    new-message msg
    write-message msg key "weather" value "nice"
    write-message msg key "distance" value "near"
    start-loop
        read-message msg key k value v status s
        if-true s not-equal GG_OKAY
            break-loop
        end-if
        @Key is <<print-out k>> and value is <<print-out v>>
    end-loop
end-handler

like?? look at her go. weather is "nice", distance is "near", and she just loops through printing keys and values like the absolute queen she is πŸ’–

🫢 SEE ALSO 🫢

  • Messages
  • get-message
  • new-message
  • read-message
  • SEMI
  • write-message
  • See all documentation

k bye ily, go make some messages πŸ’œ

this lil page was served to you by version $VERSION, dated $DATE, straight outta the GOLF(2gg) manual. mwah πŸ’‹

πŸ“¦ where this page comes from