Skip to content

Instantly share code, notes, and snippets.

@SinZ163
Created March 3, 2019 10:14
Show Gist options
  • Select an option

  • Save SinZ163/7cc3c1a7d7a760486ad7dd28ef5b42df to your computer and use it in GitHub Desktop.

Select an option

Save SinZ163/7cc3c1a7d7a760486ad7dd28ef5b42df to your computer and use it in GitHub Desktop.
colBold = chr(2)
colItalics = chr(29)
colGreen = chr(3)+"03"
colBlue = chr(3)+"02"
colBrown = chr(3)+"07"
colEnd = chr(3)
for function in functions:
className = function[0]
functionName = function[1]
functionInfo = modDotaAPI.lua_server[className]["functions"][functionName]
argInfo = ""
description = ""
if "args" in functionInfo:
if len(functionInfo["args"]) > 0:
#We have argument info
for index, arg in enumerate(functionInfo["args"]):
if index > 0:
argInfo = argInfo + ", "
if "arg_names" in functionInfo:
if len(functionInfo["arg_names"]) > 0:
#we have argument info with named variables
argInfo = argInfo + u"{nullable}{colBrown}{argType}{colBrown}{nullable} {colBlue}{argName}{colEnd}".format(
colBrown = colBrown,
colBlue = colBlue,
colEnd = colEnd,
argType = arg,
argName = functionInfo["arg_names"][index],
nullable = colItalics if "?" in arg else ""
)
continue
argInfo = argInfo + u"{nullable}{colBrown}{argType}{colEnd}{nullable}".format(
colBrown = colBrown,
colEnd = colEnd,
argType = arg,
nullable = colItalics if "?" in arg else ""
)
if argInfo != "":
argInfo = " " + argInfo + " "
if "description" in functionInfo:
description = "{colGreen} -- {description}{colEnd}".format(
description = functionInfo["description"],
colGreen = colGreen,
colEnd = colEnd
)
#self.sendMessage(output, "["+method[0]+"] "+modDotaAPI.db[method[0]]["methods"][method[1]]["return"] + " " + method[1] + colBold+"(" + colBold + msg + colBold+")" + colBold + comment)
self.sendMessage(output, "[{colBlue}{className}{colEnd}] {colBrown}{returnType}{colEnd} {name}{bold}({bold}{argInfo}{bold}){bold} {description}".format(
bold = colBold,
italic = colItalics,
colBlue = colBlue,
colBrown = colBrown,
colEnd = colEnd,
className = className,
name = functionName,
returnType = functionInfo["return"],
argInfo = argInfo,
description = description
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment