mirror of https://github.com/Hilbis/Hilbish
refactor: add emmylua docs for all functions appropriate
parent
dc608436c1
commit
a77b997942
|
@ -47,18 +47,24 @@ failed, etc. To find all available hooks, see doc hooks.`)
|
||||||
|
|
||||||
// throw(name, ...args)
|
// throw(name, ...args)
|
||||||
// Throws a hook with `name` with the provided `args`
|
// Throws a hook with `name` with the provided `args`
|
||||||
|
// --- @param name string
|
||||||
|
// --- @vararg any
|
||||||
func (b *Bait) bthrow(name string, args ...interface{}) {
|
func (b *Bait) bthrow(name string, args ...interface{}) {
|
||||||
b.Em.Emit(name, args...)
|
b.Em.Emit(name, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// catch(name, cb)
|
// catch(name, cb)
|
||||||
// Catches a hook with `name`. Runs the `cb` when it is thrown
|
// 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{})) {
|
func (b *Bait) bcatch(name string, catcher func(...interface{})) {
|
||||||
b.Em.On(name, catcher)
|
b.Em.On(name, catcher)
|
||||||
}
|
}
|
||||||
|
|
||||||
// catchOnce(name, cb)
|
// catchOnce(name, cb)
|
||||||
// Same as catch, but only runs the `cb` once and then removes the hook
|
// 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{})) {
|
func (b *Bait) bcatchOnce(name string, catcher func(...interface{})) {
|
||||||
b.Em.Once(name, catcher)
|
b.Em.Once(name, catcher)
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,8 @@ func (c *Commander) Loader(L *lua.LState) int {
|
||||||
|
|
||||||
// register(name, cb)
|
// register(name, cb)
|
||||||
// Register a command with `name` that runs `cb` when ran
|
// Register a command with `name` that runs `cb` when ran
|
||||||
|
// --- @param name string
|
||||||
|
// --- @param cb function
|
||||||
func (c *Commander) cregister(L *lua.LState) int {
|
func (c *Commander) cregister(L *lua.LState) int {
|
||||||
cmdName := L.CheckString(1)
|
cmdName := L.CheckString(1)
|
||||||
cmd := L.CheckFunction(2)
|
cmd := L.CheckFunction(2)
|
||||||
|
@ -42,6 +44,7 @@ func (c *Commander) cregister(L *lua.LState) int {
|
||||||
|
|
||||||
// deregister(name)
|
// deregister(name)
|
||||||
// Deregisters any command registered with `name`
|
// Deregisters any command registered with `name`
|
||||||
|
// --- @param name string
|
||||||
func (c *Commander) cderegister(L *lua.LState) int {
|
func (c *Commander) cderegister(L *lua.LState) int {
|
||||||
cmdName := L.CheckString(1)
|
cmdName := L.CheckString(1)
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ var exports = map[string]lua.LGFunction{
|
||||||
|
|
||||||
// cd(dir)
|
// cd(dir)
|
||||||
// Changes directory to `dir`
|
// Changes directory to `dir`
|
||||||
|
// --- @param dir string
|
||||||
func fcd(L *lua.LState) int {
|
func fcd(L *lua.LState) int {
|
||||||
path := L.CheckString(1)
|
path := L.CheckString(1)
|
||||||
|
|
||||||
|
@ -45,6 +46,8 @@ func fcd(L *lua.LState) int {
|
||||||
|
|
||||||
// mkdir(name, recursive)
|
// mkdir(name, recursive)
|
||||||
// Makes a directory called `name`. If `recursive` is true, it will create its parent directories.
|
// 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 {
|
func fmkdir(L *lua.LState) int {
|
||||||
dirname := L.CheckString(1)
|
dirname := L.CheckString(1)
|
||||||
recursive := L.ToBool(2)
|
recursive := L.ToBool(2)
|
||||||
|
@ -65,6 +68,7 @@ func fmkdir(L *lua.LState) int {
|
||||||
|
|
||||||
// stat(path)
|
// stat(path)
|
||||||
// Returns info about `path`
|
// Returns info about `path`
|
||||||
|
// --- @param path string
|
||||||
func fstat(L *lua.LState) int {
|
func fstat(L *lua.LState) int {
|
||||||
path := L.CheckString(1)
|
path := L.CheckString(1)
|
||||||
|
|
||||||
|
@ -85,6 +89,8 @@ func fstat(L *lua.LState) int {
|
||||||
|
|
||||||
// readdir(dir)
|
// readdir(dir)
|
||||||
// Returns a table of files in `dir`
|
// Returns a table of files in `dir`
|
||||||
|
// --- @param dir string
|
||||||
|
// --- @return table
|
||||||
func freaddir(L *lua.LState) int {
|
func freaddir(L *lua.LState) int {
|
||||||
dir := L.CheckString(1)
|
dir := L.CheckString(1)
|
||||||
names := L.NewTable()
|
names := L.NewTable()
|
||||||
|
|
Loading…
Reference in New Issue