phil9/lua9

Description
# Description

lua9 is a custom version of the [lua](http://lua.org) interpreter including bindings to some plan9 libraries.
The supported libraries are:
* libdraw
* libplumb
* lib9 (very partial support)  

__Disclaimer:__ This is work in progress and is sure to contain bugs.

# Installation

Make sure to have [git9](http://github.com/oridb/git9) installed first.

Install the [lua 5.4 port](https://github.com/staalmannen/lua) for plan9 by [staalmannen](https://github.com/staalmannen).  
```sh
% git/clone git://github.com/staalmannen/lua
% cd lua
% mk install
```

Install lua9:  
```sh
% git/clone git://github.com/telephil9/lua9
% cd lua9
% mk install
```

The binary is installed as `/bin/ape/lua9`.

# Usage

Refer to the [documentation](https://github.com/telephil9/lua9/blob/master/doc/README.md) and to the [samples](https://github.com/telephil9/lua9/tree/master/samples). Most notably look at the [demo](https://github.com/telephil9/lua9/blob/master/samples/demo.lua) script.

Minimal example that simply paints the window black:
```lua
#!/bin/ape/lua9

function eresized()
  draw.draw(screen, screen.r, display.black, nil, g.ZP)
end

draw.init("sample")
event.init(event.KEYBOARD)
eresized()
while true do
  local e, ev = event.event()
  if e == event.KEYBOARD then
    if ev.kbdc == key.DEL then
      os.exit()
    end
  end
end
```

# Credits

* [phil9](http://github.com/telephil9)

# License

[MIT](https://github.com/telephil9/lua9/blob/master/LICENSE)
Last 5 commits (shortlog)
Date Author Short message Commit hash
2020-10-28 telephil9 Updated README to highlight that more libraries are supported than libdraw. e9425c6570389db11a54984f712fdd6878277d61
2020-10-28 telephil9 New sample program 669b121161a14a37916469d9905457d916c468a5
2020-10-28 telephil9 Added font size computation functions to draw module 9561401327db61b80702e2744881b428e093cd79
2020-10-28 telephil9 Pass command line arguments through arg table 3c77420b78c6c828c66a5a31bf4d685e289a21e1
2020-10-28 telephil9 Change fork() to accept multiple arguments 4d255d3f3e8bba62cdf62a4b1202d83f686b05b8
Files (browse)
LICENSE
README.md
color.c
display.c
doc/
draw.c
event.c
font.c
geometry.c
image.c
key.c
ldraw.h
lib9.c
llib9.h
lplumb.h
lua9.c
mkfile
plumb.c
plumbattr.c
plumbmsg.c
samples/
utils.c
utils.h