If an admin knows what's up and can fix it that would be great, otherwise if whoever posted replies would be kind enough to reply again...
- -- Function to print properties of table
- function printProperties(pTable, pName)
- if "table" == type(pTable) then
- for k,v in pairs(pTable) do
- if "number" == type(k) then
- print(pName .. "[" .. k .. "] =", v, "(" .. type(v) .. ")")
- else
- print(pName .. "." .. k .. " =", v, "(" .. type(v) .. ")")
- end
- end
- else
- print(pName .. " =", pTable, "(" .. type(pTable) .. ")")
- end
- end
-
- -- Works with tables...
- local table = {x=123, y=456, [1]="apples", [2]={x=789, y=0}}
- printProperties(table, "table")
-
- -- ... but not with user data
- printProperties(MOAIInputMgr.device, "MOAIInputMgr.device")
-
- function printFileds(T)
- mt = getmetatable(T)
- local accm={}
- if mt and type(mt.__index)=="table" then
- for n,m in pairs (mt.__index) do
- table.insert(accm,n)
- end
- for _,n in ipairs(accm) do
- print("- "..n)
- print(" "..tostring(mt[n]),"(" .. type(mt[n]) .. ")")
- end
- accm={}
- elseif mt and type(mt.__index)=="function" then
- print("# the __index is a function")
- end
- if type(T) == "table" then
- for n in pairs(T) do
- table.insert(accm,n)
- end
- table.sort(accm)
- for _,n in ipairs(accm) do
- print("- "..n)
- print(" "..tostring(T[n]),"(" .. type(T[n]) .. ")")
- end
- else
- print(tostring(T), "(" .. type(T) .. ")")
- end
- end
- --Print the methods of all Moai classes, in alphabetic order.
- acc= {}
-
- for k,v in pairs(_G) do
- if k:find"MOAI" then table.insert(acc,k) end
- end
- table.sort(acc)
- for _,k in ipairs(acc) do
- print"\n"
- print (k)
- printFields(_G[k])
- end
Users browsing this forum: No registered users and 1 guest