View source for Module:Data
Jump to navigation
Jump to search
You do not have permission to edit this page, for the following reason:
You can view and copy the source of this page.
local p = {}
local getArgs = require('Module:Arguments').getArgs
-- args:
-- subject: The subject entity to get data from.
--- E.g., "Kerbol", "LW-Sw "SWERV""
-- param: The parameter / parameter chain to access from the data page.
--- E.g., "mass", "max_temp", "modules|engine|isp_vac", "modules|generator|outputs|units"
function p.getData(frame)
-- Get arguments from the invoke
local args = getArgs(frame) -- E.g., args = {"Example", "modules", "engine", "isp", "vac"}
-- Load the JSON from the Data: page
local dataJson = mw.loadJsonData("Data:"..args[1])
local dataVal = ""
-- Iterate through the JSON using the remaining args
for i = 2, table.maxn(args) do
-- Each loop steps into the next level JSON table,
-- leaving the final value at the end
000
1:0
Templates used on this page:
Return to Module:Data.