-- ************************************************** -- Provide Moho with the name of this script object -- ************************************************** ScriptName = "LM_MS_API" -- ************************************************** -- General information about this script -- ************************************************** LM_MS_API = {} function LM_MS_API:Name() return "API" end function LM_MS_API:Version() return "5.1" end function LM_MS_API:Description() return "Prints out the interfaces available to Lua scripts" end function LM_MS_API:Creator() return "Lost Marble, modified by Myles Strous" end function LM_MS_API:UILabel() return("Print Moho API, modified") end -- ************************************************** -- The guts of this script -- ************************************************** function LM_MS_API:Run(moho) -- local outfile = io.open("/temp/api.txt", "w") local outfilename = LM.GUI.SaveFile("Select Output Switch Data File") if (outfilename == "") then return end local outfile = io.open(outfilename, "w") if (outfile == nil) then return end outfile:write("\n\n\tMoho API\n\n") outfile:write("

Moho API

\n") outfile:write("
") outfile:write("

LM interfaces:

\n") self:PrintTableValues(LM, outfile) outfile:write("
") outfile:write("

LM.GUI interfaces:

\n") self:PrintTableValues(LM.GUI, outfile) outfile:write("
") outfile:write("

MOHO interfaces:

\n") self:PrintTableValues(MOHO, outfile) outfile:write("\n") -- outfile:write("Global variables:\n") -- self:PrintTableValues(_G, outfile) outfile:close() end function pairsByKeys (t, f) local a = {} for n in pairs(t) do table.insert(a, n) end table.sort(a, f) local i = 0 -- iterator variable local iter = function () -- iterator function i = i + 1 if a[i] == nil then return nil else return a[i], t[a[i]] end end return iter end function LM_MS_API:PrintTableValues(t, outfile) outfile:write("\n") end function LM_MS_API:PrintTableValues2(t, outfile) outfile:write(" \n") end