refactor: add emmylua docs for all functions appropriate

windows-fixes
TorchedSammy 2022-02-25 18:15:25 -04:00
parent dc608436c1
commit a77b997942
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
3 changed files with 15 additions and 0 deletions

View File

@ -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)
}

View File

@ -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)

View File

@ -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()