I’m not able to modify a table in a module script with a function in said module script. The function at it’s core sets both the key and value, but using table.insert
works - however I need to set the key, here’s what I have at the moment.
Server Script
local module = require(script.Parent.ModuleScript)
print(#module.values) -- expected 0, got 0
module.Set("test", "yo")
print(#module.values) -- expected 1, got 0
print(module.values["test"]) -- expected "yo", got nil
Module Script
local module = {}
module.values = {}
function module:Set(key, value)
module.values[key] = value
end
return module