So I was expermenting with Luau and I created this script below:
type car = {speed:number, model:string, dimensions:number, safe:boolean}
local honda = {speed=42, model="civic", dimensions=43, safe=true}
local truck = {speed=34, model="mack", dimensions=58, safe=false}
local car = {}
function car:GetSpeed(self)
self.speed = 40
return self.speed
end
print(car:GetSpeed(honda))
The topic of my concern is the function. So self is highlighted, meaning its special, but to me its just looks like any old param. If I replace “self” with “foo” or “bar”. The same results will print out aka 40.
Sorry for the late response, yes. You can ONLY use Luau for plugins in fact.
Btw I bumped this because, I still am not sure what self is useful to?? I don’t see examples of anyone really using it. Can someone give some examples?