You might have picked up one of these terrible coding habits when learning Roblox Lua. Let’s address that, shall we?
Listen… we gotta talk. You’ve got some really bad habits when it comes to scripting on Roblox. You clearly grew a lot since your days as a novice. You’ve been around the block enough times to know when it’s time to move past old habits and grow as a developer. Now’s the time to start improving your Roblox code.
OK, maybe not all of that first paragraph is completely true, but that bit about growing as a developer might interest you a whole ton. In this post, let’s talk about what you can do to clean up your coding habits.
A word of caution: this “advice” (if we’re calling it that) isn’t for the absolute novice. If you’re really-really new, just focus on making things work first and foremost. That’s more important. For the rest of you, let’s get into it!
Let’s learn about Binders, a useful pattern that links CollectionService and OOP.
In this post, I’m featuring the Binder pattern, its uses, and reasons you should start using them in your Roblox projects.
A binder connects a CollectionService tag on Instance with an object in Lua code. When a tag is applied to an Instance, an object is constructed from a class with this Instance. During its lifetime, the object might read from various attributes on the instance to modify how it behaves. Finally, if the tag or entire Instance is removed, the object is cleaned up or destroyed accordingly.
For the purposes of this article, I’ll be using this implementation (I recommend you keep this open while reading).
Apparently, I have a bit of a thing for living under a rock! The whole year of 2020 has really proven that I’m far too good at doing that. No surprise that the previous dreadful year did a number on my motivation to work on things. Although we may not be out of the woods with the pandemic yet, there’s a handful of things I’d like to cover regarding the state of my projects. In particular, here’s what I hope to accomplish in 2021 so this year turns out exceedingly excellent.