I have the following code:
-- FUNCTIONS --
local ThumbBase = {Subject = nil}
local Buttons = {}
local function CreateInput(name)
print(name)
local Type = PlayerData.Stats[name].InputType
if Type == "Thumbstick" then
Buttons[name.."Button"] = ThumbBase
Buttons[name.."Button"].Subject = Thumbstick.new(MobileUi.Moves[name], name, Buttons[name.."Button"])
end
end
function MobileActions:Enable()
CreateInput("Primary")
CreateInput("Skill1")
print(Buttons)
end
It should work fairly well. However, and this happened to me before in other instances, when I add a new table to the already existing table, apparently all of the values of the parent table get changed to the new value??? Is this something that is supposed to happen? Can I somehow bypass this?
Note that in this example, after running
MobileActions:Enable()
Buttons is a table with two equal values on different keys, while these keys are supposed to have different values. I have tried to cut the “Skill1” line and it becomes a table with the correct value.