Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/luluworlds/luluworlds
teeworlds 0.7 client written in lua
https://github.com/luluworlds/luluworlds
ddnet ddnet-client teeworlds teeworlds-client teeworlds-protocol
Last synced: about 2 months ago
JSON representation
teeworlds 0.7 client written in lua
- Host: GitHub
- URL: https://github.com/luluworlds/luluworlds
- Owner: luluworlds
- License: zlib
- Created: 2024-07-12T08:38:17.000Z (5 months ago)
- Default Branch: master
- Last Pushed: 2024-07-24T08:55:08.000Z (5 months ago)
- Last Synced: 2024-07-24T10:28:07.210Z (5 months ago)
- Topics: ddnet, ddnet-client, teeworlds, teeworlds-client, teeworlds-protocol
- Language: Lua
- Homepage:
- Size: 76.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# luluworlds
A teeworlds 0.7 client written in lua.
```
sudo apt-get install luarocks
luarocks install luluworlds-scm-0.rockspec
``````
lua client.lua "connect localhost:8303"
```## Example usage
```lua
local signal = require("posix.signal")local client = require("luluworlds.teeworlds_client")
local connection = require("luluworlds.connection")
local network = require("luluworlds.network")client:connect("127.0.0.1", 8303)
local function on_shutdown()
io.write("Quitting. Sending disconnect ...\n")
xpcall(
function ()
client.socket:send(connection.build_packet(client, {string.char(network.CTRL_CLOSE)}, true))
end,
function (err)
print("failed to disconnect: ", err)
end
)
endsignal.signal(signal.SIGINT, function(signum)
on_shutdown()
os.exit(128 + signum)
end)while true do
local data = client.socket:receive()
if data ~= nil then
client:on_data(data)
end
end
```## Tests
```
lua spec/*.lua
```