Skip to content

denpamusic/lua-lcdproc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lua-lcdproc - LCDproc client for Lua

About

lua-lcdproc is a client for LCDproc server written in Lua language using LuaSocket.

Installation

This project is available on luarocks.

$ luarocks install lua-lcdproc

OpenWrt

You can get OpenWRT package from my feed:

$ wget -P /etc/opkg/keys/ http://openwrt.denpa.pro/keys/4b148d164b058d87
$ echo src/gz denpamusic http://openwrt.denpa.pro/packages >> /etc/opkg/customfeeds.conf
$ opkg update && opkg install lua-lcdproc

Usage

local LCDproc = require "lcdproc"

-- firstly create client instance
local lcd = LCDproc("localhost", 13666)

-- then create some screens...
local screen = lcd:add_screen("my_screen")

-- ...and add some widgets to it
screen:add_title("one", "Title Text")
screen:add_string("two", 1, 2, "First Line Text")
screen:add_string("three", 1, 3, "Second Line Text")
screen:add_string("four", 1, 4, "Third Line Text")

lcd:on_listen(function (screen)
  -- text will be updated once screen is visible
  screen.widgets.two:set_text("First Line Now Has New Text")
  screen.widgets.three:set_text("Second Line Also Does")
end)

lcd:on_ignore(function (screen)
  -- do something on screen hide
end)

while true do
  local line = lcd:poll()
end

lcd:close()

Documentation

Full documentation is available at here.