Table in module script not indexing

I have a table in a module script name StandStorageDefs and the table looks like this

return {
    MaxSlots = 11,
    SlotCosts = {
        ["1"] = 0,
        ["2"] = 15000,
        ["3"] = 30000,
        ["4"] = 45000,
        ["5"] = 60000,
        ["6"] = 75000,
        ["7"] = 90000,
        ["8"] = 10500,
        ["9"] = 120000,
        ["10"] = 135000,
        ["11"] = 150000,
    }
}

I am trying to index the table with the following code:

print(require(Knit.Defs.StandStorageDefs))
local storageSlotCosts = require(Knit.Defs.StandStorageDefs.SlotCosts)


As you can see, the print statement above the line where i am setting the variable is properly requiring the table in the module. The entry for SlotCosts is clearly there and print properly.

Why do I get this error?
I also tried indexing it like this

local storageSlotCosts = require(Knit.Defs.StandStorageDefs["SlotCosts"])

but this gave the same error.

You are not requiring the module, you are requiring a non existent child of the module.

local value = require(module).index
2 Likes

OMG i need to go to sleep :stuck_out_tongue:
thank you

1 Like