summaryrefslogtreecommitdiffstats
path: root/src/Bindings/DiffAPIDesc.lua
diff options
context:
space:
mode:
authorLane Kolbly <lane@rscheme.org>2017-08-17 15:48:38 +0200
committerMattes D <github@xoft.cz>2017-08-17 15:48:38 +0200
commit7bdbfad1bbabb84e650261ad31d2d9b47f8b12a9 (patch)
tree59128a57d87d7826de450a71e060bd869e837a4a /src/Bindings/DiffAPIDesc.lua
parentUpdated docs to mention InfoDump for creating README.md, etc. (#3895) (diff)
downloadcuberite-7bdbfad1bbabb84e650261ad31d2d9b47f8b12a9.tar
cuberite-7bdbfad1bbabb84e650261ad31d2d9b47f8b12a9.tar.gz
cuberite-7bdbfad1bbabb84e650261ad31d2d9b47f8b12a9.tar.bz2
cuberite-7bdbfad1bbabb84e650261ad31d2d9b47f8b12a9.tar.lz
cuberite-7bdbfad1bbabb84e650261ad31d2d9b47f8b12a9.tar.xz
cuberite-7bdbfad1bbabb84e650261ad31d2d9b47f8b12a9.tar.zst
cuberite-7bdbfad1bbabb84e650261ad31d2d9b47f8b12a9.zip
Diffstat (limited to 'src/Bindings/DiffAPIDesc.lua')
-rw-r--r--src/Bindings/DiffAPIDesc.lua11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Bindings/DiffAPIDesc.lua b/src/Bindings/DiffAPIDesc.lua
index 8b8c340e2..54d379356 100644
--- a/src/Bindings/DiffAPIDesc.lua
+++ b/src/Bindings/DiffAPIDesc.lua
@@ -129,14 +129,17 @@ end
-- a_FunctionDoc is a single documentation item for a function, as loaded from ToLua++'s parser
local function functionDescMatchesDocs(a_FunctionDesc, a_FunctionDoc)
-- Check the number of parameters:
- local numParams
+ local numParams = 0
local numOptionalParams = 0
if (not(a_FunctionDesc.Params) or (a_FunctionDesc.Params == "")) then
numParams = 0
else
- _, numParams = string.gsub(a_FunctionDesc.Params, ",", "")
- numParams = numParams + 1
- _, numOptionalParams = string.gsub(a_FunctionDesc.Params, "%b[]", "")
+ for _, Param in pairs(a_FunctionDesc.Params) do
+ numParams = numParams + 1
+ if Param.IsOptional then
+ numOptionalParams = numOptionalParams + 1
+ end
+ end
end
local numDocParams = #(a_FunctionDoc.Params)
if ((numDocParams > numParams) or (numDocParams < numParams - numOptionalParams)) then