Hello developers,
I am looking to somehow generate a type from a table, but I am not sure how. Is there a way I can do this?
Hello developers,
I am looking to somehow generate a type from a table, but I am not sure how. Is there a way I can do this?
What do you mean generate a type from a table?
local typify = require(game:GetService("ReplicatedStorage").typify)
-- Define the table
local myTable = {
Name = "John",
Age = 25,
IsActive = true,
}
-- Create the type
local myType = typify.typeof(myTable)
-- You can now use the type to validate other tables
local otherTable = {
Name = "Mary",
Age = 30,
IsActive = false,
}
if myType.validate(otherTable) then
print("The other table is valid!")
else
print("The other table is invalid!")
end