Browse Source

Update pkgToDox.lua, add global property section.

aster2013 12 years ago
parent
commit
f2b0bb725d
1 changed files with 20 additions and 1 deletions
  1. 20 1
      Source/Engine/LuaScript/pkgs/pkgToDox.lua

+ 20 - 1
Source/Engine/LuaScript/pkgs/pkgToDox.lua

@@ -7,8 +7,9 @@ end
 pkgFiles = {}
 pkgFiles = {}
 enums = {}
 enums = {}
 classes = {}
 classes = {}
-globalConstants = {}
 globalFunctions = {}
 globalFunctions = {}
+globalProperties = {}
+globalConstants = {}
 renamings = {}
 renamings = {}
 
 
 -- trim string.
 -- trim string.
@@ -122,6 +123,8 @@ function handleLine(line)
         
         
         if line:find(")") ~= nil then -- global function.
         if line:find(")") ~= nil then -- global function.
             table.insert(globalFunctions, line)
             table.insert(globalFunctions, line)
+        elseif line:find("tolua_property") ~= nil then -- global properties
+            table.insert(globalProperties, line)
         else
         else
             local i, _, oldName, newName = line:find("$renaming%s+(.-)%s*@%s*(.-)%s*$") 
             local i, _, oldName, newName = line:find("$renaming%s+(.-)%s*@%s*(.-)%s*$") 
             if i ~= nill then -- renaming types.
             if i ~= nill then -- renaming types.
@@ -191,6 +194,21 @@ function writeGlobalFunctions(ofile)
     ofile:write("\n")
     ofile:write("\n")
 end
 end
 
 
+function writeGlobalProperties(ofile)
+    ofile:write("\\\section LuaScriptAPI_GlobalProperties Global properties\n")
+    for _, line in ipairs(globalProperties) do
+        line = line:gsub("tolua_property__get_set ", "")
+        line = line:gsub(";", "")
+        if line:find("tolua_readonly") == nil then
+            ofile:write("- ", line, "\n")
+        else
+            line = line:gsub("tolua_readonly ", "")
+            ofile:write("- ", line, " (readonly)\n")
+        end
+    end
+    ofile:write("\n")
+end
+
 function writeGlobalConstants(ofile)
 function writeGlobalConstants(ofile)
     ofile:write("\\section LuaScriptAPI_GlobalConstants Global constants\n")
     ofile:write("\\section LuaScriptAPI_GlobalConstants Global constants\n")
     for _, line in ipairs(globalConstants) do
     for _, line in ipairs(globalConstants) do
@@ -284,6 +302,7 @@ ofile:write("\n")
 writeClasses(ofile)
 writeClasses(ofile)
 writeEnums(ofile)
 writeEnums(ofile)
 writeGlobalFunctions(ofile)
 writeGlobalFunctions(ofile)
+writeGlobalProperties(ofile)
 writeGlobalConstants(ofile)
 writeGlobalConstants(ofile)
 writeRenamings(ofile)
 writeRenamings(ofile)