Hello, I am trying to create an inheritance demo using Luau, and in the subclass’s constructor, the table with the instance’s properties displays a warning: Key “__meta” not found in table. When I set __meta as a field, the warning goes away. Why does this warning occur in the first place? The warning is in the Truck class.
Car class (super class):
local Car = {}
export type Car = {
Wheels:number;
Color:string;
Name:string;
On:boolean;
}
function Car.new(wheels:number,color:string,name:string)
local self:Car = {
Wheels = wheels;
Color = color;
Name = name;
On = false;
}
setmetatable(self,{__index = Car})
return self
end
return Car
Truck class (subclass):
local Car = require(script.Parent.Car)
export type Truck = Car.Car & {
Seats:number;
Engine:string;
}
local Truck = {}
function Truck.new(wheels:number,color:string,name:string,seats:number,engine:string)
--**warning shows here 'Key "__meta" not found in table t'
local t:Truck = {
--__meta = nil; --if this line is not commented, it works fine
Wheels = wheels;
Color = color;
Name = name;
On = false;
Seats = seats;
Engine = engine;
};
setmetatable(t,{__index = Truck})
return t
end
return Truck
Any help would be appreciated. Thank you.