C# Interfaces in Roblox

Hello! Is there any way I can make some sort of a C#-like Interface for my Roblox game? I want to better organize my OOP code, and I find it to be the best tool I could think of. The problem I’m trying to fix with interfaces is I noticed that two of my modulescripts have methods with the same functionality, just slightly different from one another. If there’s any other way I could fix that please do let me know.

2 Likes

Lua’s idea of OOP doesn’t have the best support for the kind of interface you’re thinking of, which is made powerful by having strong typing behind it. Most of the abstraction guarantees you can make will only be as good as your ability to follow them, as in they will be design guarantees and not language guarantees. Lua is angled more towards functional programming and you will benefit a lot from observing some common functional patterns. Depending on what your code does you might be able to use this pattern, which I myself use a lot for approximately the same purposes as an interface.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.