I am developing a data-store modular system but I am facing some issues with organizations.
The issue is, that I am trying to duplicate the organization system that Roblox uses. For example, if I called the workspace the functions are organized in a way that I can’t call them using “.” rather than colons.
In fact, all the objects(baseparts) have this feature too. However, when using ‘.’ I get all the events/props. So hows all of that is possible? If it is.
I have tired researching on this form/hub but I didn’t see anything that solves my issue.
It displays all the members related to the specified object. Intellisense I think it is, it can actually detect fields in custom user data as well, in some cases.
e.g:
–//some module
local x = {}
function x.y()
end
return x
Pretty sure it’ll have y pop up when I index the loaded module.
Roblox uses OOP for their API.
I won’t go in depth over OOP as there are already posts that cover that.
But this is a widely used implementation of OOP in Lua
local Person = {}
Person.__index = Person
function Person.new(name)
local self = setmetatable({
name = name
}, Person)
return self
end
function Person:sayHello()
print(self.name .. " says hello")
end
-- you can now construct a new instance of Person
local myPerson = Person.new('John')
myPerson:sayHello()
I am not looking for tutorial that teaches me to code OOP programming, if you read my post, I said how to implement the way of organization they use for their services. For example, If I used colon to index something in a table, it would obviously index methods only while periods index everything while in roblox objects/services the colons index functions/methods while periods only index events/props. And thats exactly my question, how they do it?