luabox

command module
v0.0.0-...-f110a76 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2015 License: Apache-2.0 Imports: 9 Imported by: 0

README

Luabox is a tiny library for writing console apps in Lua. It uses gopher-lua as the interpreter and termbox-go to interface with the terminal.

$ git clone https://github.com/ferbivore/luabox
$ go build
$ ./luabox examples/single-event.lua

You can also go get -u https://github.com/ferbivore/luabox if you like executables in your path. Here's what an extremely simple program, which prints ! to your terminal and quits when you press Ctrl-C, looks like:

function luabox.load()
    termbox.set(1, 1, "!")
end
function luabox.event(e)
    if e.key == termbox.key.CtrlC then
        luabox.quit()
    end
end

Luabox calls luabox.load() when starting up and luabox.event(e) when receiving a Termbox event. e is just a table - you can run the examples/single-event.lua file to see what it looks like. The termbox module offers a bunch of functions and constants you can use - see api.go for details.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL