lua9 is a custom lua interpreter including bindings to various plan9 libraries. This document is not meant to replace the plan9 documentation, please refer to the man pages in section 2 for the documentation of individual functions.
The API is mostly a one-for-one translation of the C API with some slight changes to make the API feel more "lua-ish". The most significant differences are:
- The API is split across several modules (draw, event, etc.).
- Naming respects lua conventions instead of their original C name.
- Functions that take pointers as out parameters (e.g. event) instead return the value and may return multiple values (e.g. icossin).
- In lua, indices start at one not zero. The API respects the lua convention for function returning indices (e.g. emenuhit)
- Value types (e.g. Point, Rectangle) are mapped as lua tables, reference types (e.g. Image, Font) as userdata.
This is the C initdraw
function.
The important difference is that it does not handle the additional parameters allowed by initdraw
.
When called, init
will check for the existence of an eresized
function as with the C API.
Upon success, three global variables are defined: display
, screen
and font
.
Returns two values: cosp
and sinp
Returns two values: cosp
and sinp
The following constants are exported:
END_SQUARE
,END_DISC
,END_ARROW
,END_MASK
Initialize event handling. This is the einit
C function.
Returns:
- The event key
- The event structure
The s
parameter is used as an initial value in the text field.
The menu
is expected to be a table of strings. The generation of menu items is not supported currently.
Returns:
- Selected index (starting at 1) or
nil
The following constants are exported:
MOUSE
,KEYBOARD
Geometry related functions.
Checks whether k is equal to str. This is a convenience function to help with lua not having a character type.
The following constants are exported:
HOME
,UP
,DOWN
,PGUP
,PRINT
,LEFT
,RIGHT
,PGDOWN
,INS
,END
,SOH
,STX
,ETX
,EOF
,ENQ
,ACK
,BS
,NACK
,ETB
,DEL
,ESC
.
The following constants are exported:
OPAQUE
,TRANSPARENT
,BLACK
,WHITE
,RED
,GREEN
,BLUE
,CYAN
,MAGENTA
,YELLOW
,PALE_YELLOW
,DARK_YELLOW
,PALE_GREEN
,DARK_GREEN
,MED_GREEN
,DARK_BLUE
,PALE_BLUE_GREEN
,PALE_BLUE
,BLUE_GREEN
,GREY_GREEN
,PALE_GREY_GREEN
,YELLOW_GREEN
,MED_BLUE
,GREY_BLUE
,PALE_GREY_BLUE
,PURPLE_BLUE
,NOT_A_COLOR
,NO_FILL