Skip to content

Commit

Permalink
feat: adds buffer.GetArg for use by lua plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
taconi committed Jan 7, 2024
1 parent 2d82362 commit f3694c9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/micro/initlua.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ func luaImportMicroBuffer() *lua.LTable {
ulua.L.SetField(pkg, "ByteOffset", luar.New(ulua.L, buffer.ByteOffset))
ulua.L.SetField(pkg, "Log", luar.New(ulua.L, buffer.WriteLog))
ulua.L.SetField(pkg, "LogBuf", luar.New(ulua.L, buffer.GetLogBuf))
ulua.L.SetField(pkg, "GetArg", luar.New(ulua.L, buffer.GetArg))

return pkg
}
Expand Down
1 change: 1 addition & 0 deletions runtime/help/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ The packages and functions are listed below (in Go type signatures):

- `Log(s string)`: writes a string to the log buffer.
- `LogBuf() *Buffer`: returns the log buffer.
- `GetArg(b *Buffer) (string, int)`: gets the most recent word (separated by ' ' only).
* `micro/util`
- `RuneAt(str string, idx int) string`: returns the utf8 rune at a
given index within a string.
Expand Down

0 comments on commit f3694c9

Please sign in to comment.