Skip to content

Commit

Permalink
LDoc - Adjust all tags for dynamic functions to prevent LDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
CuteOne committed Aug 16, 2023
1 parent f1890ad commit 4ebbeae
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 111 deletions.
20 changes: 10 additions & 10 deletions .github/generate_dynamic_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@
with open(filepath, "r") as f:
lines = f.readlines()

# Iterate over the lines and look for the @dynamicFunction tag
# Iterate over the lines and look for the @xFunction tag
i = 0
while i < len(lines):
line = lines[i]
if "@dynamicFunction" in line:
func_name = re.search(r"@dynamicFunction (.+)", line).group(1)
if "@xFunction" in line:
func_name = re.search(r"@xfunction (.+)", line).group(1)
doc_block = [f"### {func_name}\n"]
i += 1
while i < len(lines) and not lines[i].strip().startswith("cast."):
if "@description" in lines[i]:
description = re.search(r"@description (.+)", lines[i]).group(1)
if "@xdescription" in lines[i]:
description = re.search(r"@xdescription (.+)", lines[i]).group(1)
doc_block.append(f"\n{description}\n")
elif "@tparam" in lines[i]:
tparam = re.search(r"@tparam (.+)", lines[i]).group(1)
elif "@xtparam" in lines[i]:
tparam = re.search(r"@xtparam (.+)", lines[i]).group(1)
doc_block.append(f"- Parameter: {tparam}")
elif "@return" in lines[i]:
return_val = re.search(r"@return (.+)", lines[i]).group(1)
elif "@xreturn" in lines[i]:
return_val = re.search(r"@xreturn (.+)", lines[i]).group(1)
doc_block.append(f"- Returns: {return_val}")
i += 1
docs.append("\n".join(doc_block) + "\n")
Expand All @@ -45,4 +45,4 @@

# Write the documentation to a Markdown file
with open(os.path.join(script_dir, "..", "DOCS.md"), "w") as f:
f.write("\n".join(docs))
f.write("\n".join(docs))
25 changes: 16 additions & 9 deletions System/API/Buff.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ br.api.buffs = function(buff,v)
--- Cancel a buff.
-- @tparam[opt="player"] string thisUnit The unit to check.
-- @tparam[opt="player"] string sourceUnit The source of the buff.
-- @usage local anima = br.player.animas
-- anima.spell.cancel("player") -- Cancels the buff from the player.
-- @usage local buff = br.player.buff
-- buff.spell.cancel("player") -- Cancels the buff from the player.
buff.cancel = function(thisUnit,sourceUnit)
if thisUnit == nil then thisUnit = 'player' end
if sourceUnit == nil then sourceUnit = 'player' end
Expand All @@ -37,7 +37,8 @@ br.api.buffs = function(buff,v)
-- @tparam[opt="player"] string thisUnit The unit to check.
-- @tparam[opt="player"] string sourceUnit The source of the buff.
-- @treturn number The duration of the buff in seconds.
-- @usage local duration = br.player.buff.spell.duration("player") -- Gets the duration of the buff on the player.
-- @usage local duration = br.player.buff
-- buff.spell.duration("player") -- Gets the duration of the buff on the player.
buff.duration = function(thisUnit,sourceUnit)
if thisUnit == nil then thisUnit = 'player' end
if sourceUnit == nil then sourceUnit = 'player' end
Expand All @@ -48,7 +49,8 @@ br.api.buffs = function(buff,v)
-- @tparam[opt="player"] string thisUnit The unit to check.
-- @tparam[opt="player"] string sourceUnit The source of the buff.
-- @treturn boolean True if the buff exists, false otherwise.
-- @usage local exists = br.player.buff.spell.exists("player") -- Checks if the buff exists on the player.
-- @usage local exists = br.player.buff
-- buff.spell.exists("player") -- Checks if the buff exists on the player.
buff.exists = function(thisUnit,sourceUnit)
if thisUnit == nil then thisUnit = 'player' end
if sourceUnit == nil then sourceUnit = 'player' end
Expand All @@ -59,7 +61,8 @@ br.api.buffs = function(buff,v)
-- @tparam[opt="player"] string thisUnit The unit to check.
-- @tparam[opt="player"] string sourceUnit The source of the buff.
-- @treturn boolean True if the buff has a reaction delay, false otherwise.
-- @usage local react = br.player.buff.spell.react("player") -- Checks the reaction delay of the buff on the player.
-- @usage local react = br.player.buff
-- buff.spell.react("player") -- Checks the reaction delay of the buff on the player.
buff.react = function(thisUnit, sourceUnit)
thisUnit = thisUnit or "player"
sourceUnit = sourceUnit or "player"
Expand All @@ -70,7 +73,8 @@ br.api.buffs = function(buff,v)
-- @tparam[opt="player"] string thisUnit The unit to check.
-- @tparam[opt="player"] string sourceUnit The source of the buff.
-- @treturn number The remaining time of the buff in seconds.
-- @usage local remain = br.player.buff.spell.remain("player") -- Gets the remaining time of the buff on the player.
-- @usage local remain = br.player.buff
-- buff.spell.remain("player") -- Gets the remaining time of the buff on the player.
buff.remain = function(thisUnit,sourceUnit)
if thisUnit == nil then thisUnit = 'player' end
if sourceUnit == nil then sourceUnit = 'player' end
Expand All @@ -81,7 +85,8 @@ br.api.buffs = function(buff,v)
-- @tparam[opt="player"] string thisUnit The unit to check.
-- @tparam[opt="player"] string sourceUnit The source of the buff.
-- @treturn number The remaining time of the buff in seconds.
-- @usage local remain = br.player.buff.spell.remain("player") -- Gets the remaining time of the buff on the player.
-- @usage local remain = br.player.buff
-- buff.spell.remain("player") -- Gets the remaining time of the buff on the player.
buff.remains = function(thisUnit,sourceUnit)
if thisUnit == nil then thisUnit = 'player' end
if sourceUnit == nil then sourceUnit = 'player' end
Expand All @@ -92,7 +97,8 @@ br.api.buffs = function(buff,v)
-- @tparam[opt="player"] string thisUnit The unit to check.
-- @tparam[opt="player"] string sourceUnit The source of the buff.
-- @treturn boolean True if the buff should be refreshed, false otherwise.
-- @usage local shouldRefresh = br.player.buff.spell.refresh("player") -- Checks if the buff on the player should be refreshed.
-- @usage local shouldRefresh = br.player.buff
-- buff.spell.refresh("player") -- Checks if the buff on the player should be refreshed.
buff.refresh = function(thisUnit,sourceUnit)
return buff.remain(thisUnit,sourceUnit) <= buff.duration(thisUnit,sourceUnit) * 0.3
end
Expand All @@ -101,7 +107,8 @@ br.api.buffs = function(buff,v)
-- @tparam[opt="player"] string thisUnit The unit to check.
-- @tparam[opt="player"] string sourceUnit The source of the buff.
-- @treturn number The stack count of the buff.
-- @usage local stacks = br.player.buff.spell.stack("player") -- Gets the stack count of the buff on the player.
-- @usage local stacks = br.player.buff
-- buff.spell.stack("player") -- Gets the stack count of the buff on the player.
buff.stack = function(thisUnit,sourceUnit)
if thisUnit == nil then thisUnit = 'player' end
if sourceUnit == nil then sourceUnit = 'player' end
Expand Down
Loading

0 comments on commit 4ebbeae

Please sign in to comment.