2014-04-10 19:29:17 +00:00
|
|
|
# lovebird
|
2014-04-12 17:03:39 +00:00
|
|
|
A browser-based debug console for the [LÖVE](http://love2d.org) framework.
|
2014-04-10 19:29:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
## Usage
|
2014-04-10 22:45:18 +00:00
|
|
|
Drop the [lovebird.lua](lovebird.lua?raw=1) file into an existing project and
|
|
|
|
place the following line at the top of your `love.update()` function:
|
2014-04-10 19:29:17 +00:00
|
|
|
```lua
|
|
|
|
require("lovebird").update()
|
|
|
|
```
|
2014-04-12 17:03:39 +00:00
|
|
|
The console can then be accessed by opening the following URL in a web browser:
|
2014-04-10 19:29:17 +00:00
|
|
|
```
|
|
|
|
http://localhost:8000
|
|
|
|
```
|
2014-04-12 17:03:39 +00:00
|
|
|
If you want to access lovebird from another computer on the same network then
|
|
|
|
`localhost` should be replaced with the IP address of the computer which LÖVE
|
|
|
|
is running on.
|
2014-04-10 19:29:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
## Additional Functionality
|
2014-04-12 17:03:39 +00:00
|
|
|
To make use of additional functionality, the module can be assigned to a
|
|
|
|
variable when it is required:
|
2014-04-10 19:29:17 +00:00
|
|
|
```lua
|
|
|
|
lovebird = require "lovebird"
|
|
|
|
```
|
2014-04-10 22:45:18 +00:00
|
|
|
Any configuration variables should be set before `lovebird.update()` is called.
|
2014-04-10 19:29:17 +00:00
|
|
|
|
|
|
|
### lovebird.port
|
|
|
|
The port which lovebird listens for connections on. By default this is `8000`
|
|
|
|
|
|
|
|
### lovebird.whitelist
|
|
|
|
A table of hosts which lovebird will accept connections from. Any connection
|
|
|
|
made from a host which is not on the whitelist is logged and closed
|
2014-04-10 22:36:15 +00:00
|
|
|
immediately. If `lovebird.whitelist` is set to nil then all connections are
|
2014-04-12 17:03:39 +00:00
|
|
|
accepted. The default is `{ "127.0.0.1", "192.168.*.*" }`.
|
2014-04-10 19:29:17 +00:00
|
|
|
|
|
|
|
### lovebird.wrapprint
|
|
|
|
Whether lovebird should wrap the `print()` function or not. If this is true
|
|
|
|
then all the calls to print will also be output to lovebird's console. This is
|
|
|
|
`true` by default.
|
|
|
|
|
|
|
|
### lovebird.maxlines
|
|
|
|
The maximum number of lines lovebird should store in its console's output
|
|
|
|
buffer. By default this is `200`.
|
|
|
|
|
2014-04-12 17:03:39 +00:00
|
|
|
### lovebird.updateinterval
|
|
|
|
The interval in seconds that the page's information is updated; this is `0.5`
|
|
|
|
by default.
|
2014-04-10 19:29:17 +00:00
|
|
|
|
2014-04-11 18:01:22 +00:00
|
|
|
### lovebird.allowhtml
|
|
|
|
Whether prints should allow HTML. If this is true then any HTML which is
|
|
|
|
printed will be rendered as HTML; if it false then all HTML is rendered as
|
2014-04-13 09:36:24 +00:00
|
|
|
text. This is `false` by default.
|
2014-04-11 18:01:22 +00:00
|
|
|
|
2014-04-10 19:29:17 +00:00
|
|
|
### lovebird.print(...)
|
|
|
|
Prints its arguments to lovebird's console. If `lovebird.wrapprint` is set to
|
|
|
|
true this function is automatically called when print() is called.
|
|
|
|
|
2014-04-12 17:03:39 +00:00
|
|
|
### lovebird.clear()
|
|
|
|
Clears the contents of the console, returning it to an empty state.
|
|
|
|
|