Sorry if this is in the wrong forum.
I made a module for saving my stats using CrawlSpaceLib (because I was too lazy to make my own module for saving to a file) and in that module i have
stats = {totalBubblesTouched = 0, totalBubblesMissed = 0, totalNastiesTouched = 0, totalNastiesLetPass = 0, totalMissfires = 0, totalPowerupsUsed = 0, totalPowerupsGot = 0, maxBubbles = 0, maxNasties = 0, maxMissfires = 0, maxPowerupsUsed = 0, maxPowerupsGot = 0}
function saveStat(statName, statNum)
print(statName)
print(statNum)
if (stats[statName] == nil) then
stats[statName] = statNum
else
stats[statName] = stats[statName] + statNum
end
end
I then run it using this in main.lua
function missfireCheck(event)
if (event.phase == "began") then
statsControl:saveStat("totalMissfires", 1)
missfires = missfires + 1
print ("Missfires:"..missfires)
end
end
background:addEventListener("touch", missfireCheck)
The expected output is
totalMissfires
1
Missfires :1
totalMissfires
but I get
Output Table Data:
Key: getStat Value: function: 0x466090
Key: stats Value: table: 0x472040
Key: \_NAME Value: statsControl
Key: \_PACKAGE Value:
Key: hardSaveStat Value: function: 0x466070
Key: \_M Value: table: 0x488640
Key: saveStat Value: function: 0x466050
Key: statsDataNilCheck Value: function: 0x472060
Output string :: totalMissfires
Output string :: Missfires :1
Output Table Data:
Key: getStat Value: function: 0x466090
Key: stats Value: table: 0x472040
Key: \_NAME Value: statsControl
Key: \_PACKAGE Value:
Key: hardSaveStat Value: function: 0x466070
Key: \_M Value: table: 0x488640
Key: saveStat Value: function: 0x466050
Key: statsDataNilCheck Value: function: 0x472060
Anyone know whats happening here? [import]uid: 22824 topic_id: 9821 reply_id: 309821[/import]