Next year will mark my first decade programming on ROBLOX.
I have seen many games codebases which hit front-page, and many more upcoming that are huge titles.
I have released my own games, and made a lot of money, then realized I love more than money.
I love to program. If I ever get the opportunity to become an engineer at ROBLOX to expand my understanding of what it means to program, I will surely take it.
I would sacrifice all my money to do so, again.
This is an example of my code, I won’t explain it, and I hope the right person who sees this and can understand why I believe it to be very good is also aware of more impressive methods to teach me one day.
Every script in this framework simply returns a table {}. Even the code which sets up the inheritance.
return {
cache = {},
hooks = {"camera","interface","mechanics"},
init = function(self)
self.player:hook()
self.ai:hook()
end,
new = function(self,characterInstance,controller)
if not self.wrapped(controller) then
local character = setmetatable(
{
UID = self.HttpService:GenerateGUID(false),
_Player = controller,
_Instance = characterInstance,
_janitor = self.Janitor.new(),
},
self:object(characterInstance)
):_hook()
controller._Character = character
self.cache[character.UID] = character
end
end,
_hook = function(self)
for _,hook in self.hooks do
if self[hook] then
self[hook]:hook(self)
end
end
return self
end,
wrapped = function(self,characterInstance)
if self._Character then
if self._Character == characterInstance then
return true
else
if self._Character.removed then
self._Character:removed()
end
self._Character = nil
end
end
end,
removed = function(self,removing)
local UID = self.UID
if UID then
self.character.cache[UID] = nil
end
if removing and self._Player then
self._Player:removed()
end
self:clean()
end,
removing = function(self,UID,...)
local controller = self.cache[UID]
if controller then
controller:removed(true)
controller = nil
self.cache[UID] = nil
end
end,
hook = function(self,controller)
self:new(controller.Character or controller.CharacterAdded:Wait(),controller)
controller._janitor:Add(controller.CharacterAdded:Connect(
function(Character)
self:new(Character,controller)
end)
)
end,
}