From a77b99794254ec84d91781863eb2d1a3f861f0ba Mon Sep 17 00:00:00 2001 From: TorchedSammy <38820196+TorchedSammy@users.noreply.github.com> Date: Fri, 25 Feb 2022 18:15:25 -0400 Subject: [PATCH] refactor: add emmylua docs for all functions appropriate --- golibs/bait/bait.go | 6 ++++++ golibs/commander/commander.go | 3 +++ golibs/fs/fs.go | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/golibs/bait/bait.go b/golibs/bait/bait.go index 81387c1..491d9ab 100644 --- a/golibs/bait/bait.go +++ b/golibs/bait/bait.go @@ -47,18 +47,24 @@ failed, etc. To find all available hooks, see doc hooks.`) // throw(name, ...args) // Throws a hook with `name` with the provided `args` +// --- @param name string +// --- @vararg any func (b *Bait) bthrow(name string, args ...interface{}) { b.Em.Emit(name, args...) } // catch(name, cb) // Catches a hook with `name`. Runs the `cb` when it is thrown +// --- @param name string +// --- @param cb function func (b *Bait) bcatch(name string, catcher func(...interface{})) { b.Em.On(name, catcher) } // catchOnce(name, cb) // Same as catch, but only runs the `cb` once and then removes the hook +// --- @param name string +// --- @param cb function func (b *Bait) bcatchOnce(name string, catcher func(...interface{})) { b.Em.Once(name, catcher) } diff --git a/golibs/commander/commander.go b/golibs/commander/commander.go index 3390de8..3fbc1a5 100644 --- a/golibs/commander/commander.go +++ b/golibs/commander/commander.go @@ -31,6 +31,8 @@ func (c *Commander) Loader(L *lua.LState) int { // register(name, cb) // Register a command with `name` that runs `cb` when ran +// --- @param name string +// --- @param cb function func (c *Commander) cregister(L *lua.LState) int { cmdName := L.CheckString(1) cmd := L.CheckFunction(2) @@ -42,6 +44,7 @@ func (c *Commander) cregister(L *lua.LState) int { // deregister(name) // Deregisters any command registered with `name` +// --- @param name string func (c *Commander) cderegister(L *lua.LState) int { cmdName := L.CheckString(1) diff --git a/golibs/fs/fs.go b/golibs/fs/fs.go index c9bb107..1cbe301 100644 --- a/golibs/fs/fs.go +++ b/golibs/fs/fs.go @@ -31,6 +31,7 @@ var exports = map[string]lua.LGFunction{ // cd(dir) // Changes directory to `dir` +// --- @param dir string func fcd(L *lua.LState) int { path := L.CheckString(1) @@ -45,6 +46,8 @@ func fcd(L *lua.LState) int { // mkdir(name, recursive) // Makes a directory called `name`. If `recursive` is true, it will create its parent directories. +// --- @param name string +// --- @param recursive bool func fmkdir(L *lua.LState) int { dirname := L.CheckString(1) recursive := L.ToBool(2) @@ -65,6 +68,7 @@ func fmkdir(L *lua.LState) int { // stat(path) // Returns info about `path` +// --- @param path string func fstat(L *lua.LState) int { path := L.CheckString(1) @@ -85,6 +89,8 @@ func fstat(L *lua.LState) int { // readdir(dir) // Returns a table of files in `dir` +// --- @param dir string +// --- @return table func freaddir(L *lua.LState) int { dir := L.CheckString(1) names := L.NewTable()