People write code to their preference, not everyone would write like how you would. You make some good points, but if you think in the performance aspect, this somewhat makes almost to no difference. You also suggested some stuff that does have some performance cost, such as assert, with ~10-20% slower speeds, and indexed table rather than array tables with ~2-8% speed difference.
I do agree with the indexed table though, it should be more easier for the developers to understand it.
Unfortunate as I was just about to release my own take on something like this. Regardless, please don’t use colons for cosmetic purposes, it can create issues and this just isn’t a use case for a colon.
When you assign a function using a colon roblox assumes it is a method and will provide a self variable, if you call it normally (using a period) because it has nothing to do with objects or OOP as a whole, the first parameter will automatically be assigned to a non-existent self and will just, not work.
local module = {}
function module:doSomething(string)
print(string)
end
module:doSomething("Hello, World!")
-- Hello, World!
module.doSomething("Hello, World!")
-- nil
TL;DR
Don’t create methods unless you are going to use self.
Edit: Alternatively you could just use self as outlined in @Gooncreeper’s post but I’d recommend just using normal functions as this has nothing to do with OOP
Hello everyone thank you for your feedback. I will be definitely utilizing them In the next update! Although some of you say that assert gives bad performance, I am not sure if its true, Please answer this poll so I know if i should use it.
The module might be useless, but hey, It exists and can be used for quick access to functions such as Ban, Warning and such and next update will also come with Time Bans! The code is open source so you can customize this as much as you want.
I mean, it has a good concept but it’s limiting and only has certain use case of banning etc. Some nice features would be the ability to see all users who are banned, temp banning, and another nice feature would be the ability to like use your own custom datastore in order to store the bans.
I did some benchmarking and assert is 3x slower then an if statement, however the difference was so small I highly doubt it will even make a noticeable difference.