Skip to content

Instantly share code, notes, and snippets.

View prtksxna's full-sized avatar
🐢
Slow and steady

Prateek Saxena prtksxna

🐢
Slow and steady
View GitHub Profile

Methods

So far we have explored the usage of functions in GML 2.3; however, this is not the full picture. In the examples we've looked at so far, there is actually a decent amount of work that the compiler is hiding from us. In order to fully understand the intricacies of functions and how they deal with scoping we must intimately understand what methods are and how they work under the hood.

Let's first revisit the definition of a function in GML: code to be executed. Recall that functions are actually resources, with a resource index stored in a real.

A method is a function bound to a struct (or instance) via the variable self.

So what does this mean exactly? On the surface this may seem like an insignificant distinction. This distinction is critically important when we start considering the context in which functions are called and execute from.

Let's begin by exploring how the compiler hides methods from us when dealing with global functions:

@fats
fats / weechat_grayout.txt
Last active September 26, 2022 17:05
[weechat] Gray out join/part/quit messages
/set irc.look.color_nicks_in_server_messages off
/set colorize_nicks.look.ignore_tags irc_join,irc_part,irc_quit
/set irc.color.message_join darkgray
/set irc.color.message_quit darkgray
/set irc.color.reason_quit darkgray
/set weechat.color.chat_tags darkgray
/set weechat.color.chat_nick darkgray
/set weechat.color.chat_host darkgray
/set weechat.color.chat_delimiters darkgray
/set weechat.color.chat_channel darkgray
@aaronpk
aaronpk / README.md
Last active February 16, 2021 18:02

Swap out the two URLs (first is source, second is target) then run with curl:

curl -X POST -d @pingback.xml http://example.com/xmlrpc