Can't get a string from a table

local snd = {}
snd.__index = snd
self = setmetatable(snd,{})

self.allocateMaterials = {
	["Concrete"] = {"Conc", 5};
	["Fabric"] = {"Conc", 5};
	["Grass"] = {"Grass", 5};
	["Slate"] = {"Dirt", 5};
	["Metal"] = {"Metal", 10};
	["Sand"] = {"Sand", 5};
	["Plastic"] = {"Tile", 5};
	["Marble"] = {"Tile", 5};
	["SmoothPlastic"] = {"Tile", 5};
	["Wood"] = {"Wood", 5};
	["WoodPlanks"] = {"Wood", 5};
	["Asphalt"] = {"Asph", 5}
};

local materialAtt = self.allocateMaterials[args[1]] -- args are {floorMaterial}
print(materialAtt) -- this returns the table i want
print(materialAtt[1]) -- however this errors, i have no idea why.

I genuinely have no idea why this isn’t working.

What do you mean with “however this errors”. What exactly is the error?

Attempt to index nil with number

I kept calling it while the FloorMaterial is air, meaning that there is no table.

HAH!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.