Luau Warning: Key "__meta" not found in table

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.

Because Luau is unstable right now and has a lot of bugs. It is not meant to be used in production code yet.

1 Like