-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# A Lua API for Norgopolis Clients | ||
|
||
For information about Norgopolis, consult https://github.com/nvim-neorg/norgopolis. | ||
|
||
This repository acts as a wrapper around https://github.com/nvim-neorg/norgopolis-client for Lua. | ||
Any Lua application may install this repository as a dependency and communicate with Norgopolis | ||
and its modules. | ||
|
||
# Installation | ||
|
||
```sh | ||
luarocks --local install norgopolis-client.lua | ||
``` | ||
|
||
# Usage | ||
|
||
`norgopolis-client.lua` exposes a very simple yet extendable API: | ||
|
||
```lua | ||
-- Connect to Norgopolis. The port number may be omitted and will default to 62020. | ||
local norgopolis = require("norgopolis").connect("localhost", "62020") | ||
|
||
-- Invoke a function of a given module. The third argument is the parameters to send | ||
-- over to the module. It may be nil or any inbuilt Lua datatype. | ||
-- This will most commonly be a table. | ||
norgopolis:invoke("module-name", "function-name", "hello!", function(ret) | ||
-- This function gets invoked every time a module responds back with a response | ||
-- packet. `ret` could be anything, so be careful! | ||
print(ret) | ||
end) | ||
``` |