Anonymous

Module:Sandbox/FalterTest: Difference between revisions

From Melvor Idle
More lua testing
(testing stuff in Lua)
 
(More lua testing)
Line 1: Line 1:
local p = {}
local p = {}


function p.test(frame)
local Constants = mw.loadData('Module:Constants/data')
    local thing = mw.text.jsonDecode('{"id":0,"category":"Thieving","type":"Logs","name":"Normal Logs","sellsFor":1,"media":"assets/media/bank/logs_normal.svg?2","masteryID":[2,0],"firemakingID":0}')
local MonsterData = mw.loadData('Module:Monsters/data')
     --local thing = {Name = "Blah", Number = 7}
 
    mw.logObject(thing)
function p.getMonsterStat(frame)
    mw.log(mw.text.jsonEncode(thing))
  local MonsterName = frame.args[1]
     mw.log("Doing stuff")
  local StatName = frame.args[2]
    return 7
  local result = 'No monster found with that name'
  for key, value in pairs(MonsterData) do
     if(value.name == MonsterName) then
      --mw.logObject(value)
      mw.log(StatName)
      result = value[StatName]
     end
  end
  return result
end
end


return p
return p