aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2017-11-07 00:07:35 -0500
committerAlexander Pickering <alexandermpickering@gmail.com>2017-11-07 00:07:35 -0500
commit38a05e947d041f8b9c42e49eb075b972a7e9355c (patch)
tree95ac5ab2b2f323d495745166154a904915bcf686
parent021d8e86d264e098f9fdce265300ceeb9207506e (diff)
downloadartery-38a05e947d041f8b9c42e49eb075b972a7e9355c.tar.gz
artery-38a05e947d041f8b9c42e49eb075b972a7e9355c.tar.bz2
artery-38a05e947d041f8b9c42e49eb075b972a7e9355c.zip
Added luadocs for shared libraries
Started working on documentation
-rw-r--r--config.ld16
-rw-r--r--gamemode/shared/concommands.lua9
-rw-r--r--gamemode/shared/log.lua24
-rw-r--r--gamemode/shared/sparkel.lua20
4 files changed, 41 insertions, 28 deletions
diff --git a/config.ld b/config.ld
new file mode 100644
index 0000000..71cf32f
--- /dev/null
+++ b/config.ld
@@ -0,0 +1,16 @@
+project = 'Artery'
+description = 'Artery gamemode base'
+full_description = 'A hefty gamemode base for making rpgs in Garrys Mod'
+title = 'Artery Documentation'
+style = '!fixed'
+use_markdown_titles = true
+file = {
+ ".",
+ exclude={
+ "gamemode/core/database/sv_mysqlite.lua"
+ }
+}
+format = 'markdown'
+sort_modules = true
+new_type("domain","Domain")
+new_type("concommand","Console commands", false, ...)
diff --git a/gamemode/shared/concommands.lua b/gamemode/shared/concommands.lua
index 64d9a35..79ea0f3 100644
--- a/gamemode/shared/concommands.lua
+++ b/gamemode/shared/concommands.lua
@@ -1,11 +1,14 @@
---[[
- Various console command helper functions
-]]
+--- Concommand autocomplete helper.
+-- Helps you write console commands' autocomplete functions
+--@module concommands.lua
local fuzzel = nrequire("fuzzel.lua")
local concmd = {}
+--- Generate an autocomplete function.
+-- Generates an autocomplete function based on the strings passed in.
+-- The strings can be passed in as a list of arguments, or in an array.
function concmd.AutocompleteFunction(...)
local opt = {...}
opt = type(opt[1]) == "table" and opt[1] or opt
diff --git a/gamemode/shared/log.lua b/gamemode/shared/log.lua
index 618fd0c..24fe58f 100644
--- a/gamemode/shared/log.lua
+++ b/gamemode/shared/log.lua
@@ -1,7 +1,11 @@
+--- Logging utility.
+-- This prints things to the console for now, maybe it can automatically file bugs and save bug reports in the future?
+--@module log.lua
+
+local log = {}
local fn = nrequire("fn.lua")
local col = nrequire("colortheme.lua")
-local log = {}
local domain
if SERVER then
domain = "[SERVER]"
@@ -9,20 +13,30 @@ elseif CLIENT then
domain = "[CLIENT]"
end
+--- Print a debug message.
+-- This can be suppressed in release versions
function log.debug(...)
- MsgC(col.console.gray,domain,"[DEBUG]",...,"\n")
+ MsgC(col.console.gray,domain,"[DEBUG]",table.concat({...}," "),"\n")
end
+--- Print an information message.
+-- Things server owners might want to see
function log.info(...)
- MsgC(col.console.cyan,domain,"[INFO]",...,"\n")
+ MsgC(col.console.cyan,domain,"[INFO]",table.concat({...}," "),"\n")
end
+--- Prints a warning.
+-- Things developers need to look at
+-- Maybe print this to a file in the future?
function log.warn(...)
- MsgC(col.console.yellow,domain,"[WARNING]",...,"\n")
+ MsgC(col.console.yellow,domain,"[WARNING]",table.concat({...}," "),"\n")
end
+--- Prints an error.
+-- Things that should never happen
+-- Maybe have this automatically make bugs on the bug tracker with the above log files?
function log.error(...)
- MsgC(col.console.red,domain,"[ERROR]",...,"\n")
+ MsgC(col.console.red,domain,"[ERROR]",table.concat({...}," "),"\n")
end
log.report = fn.curry(
diff --git a/gamemode/shared/sparkel.lua b/gamemode/shared/sparkel.lua
deleted file mode 100644
index c839059..0000000
--- a/gamemode/shared/sparkel.lua
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-local function sparkel(...)
- local arg = {...}
- local looparg = type(arg[1]) == "string" and string.Explode(" ",arg[1],false) or arg
- --One pass to find the high and low point
- local max,min = tonumber(looparg[1]),tonumber(looparg[1])
- for k,v in pairs(looparg) do
- v = tonumber(v)
- max = max > v and max or v
- min = min < v and min or v
- end
- local scale = (max-min) / 7
- for k,v in pairs(looparg) do
- Msg(utf8.char(9600 + ( 1 + (v / scale))))
- end
- Msg("\n")
-end
-
-return sparkel