local function wrap(instance)
return setmetatable({ this = instance }, { __index = instance })
end
local wrapped = wrap(Instance.new("Part"))
function wrapped:test()
print(self.Name)
end
wrapped:test()
A global function would probably need to be stored in a module script.
local funcs = {}
local object = Instance.new(“Part”,workspace)
function funcs:test() --(I want to be able to use self)
print(self.Name)
end
return funcs
Yeah, you and @sjr04 got it. I’ve decided against using it though as it really has no functional benefit in rbxlua. It’s fun to play with but decreases efficiency, really just syntactic sugar.