site-logo

Lintouch, the opensource HMI

Lua Plugin

Author: Lintouch Development Team
Version: 1.8.1
License: GPL2
Download: This plugin is distributed along with the Lintouch

Lintouch Lua Server Plugin allows you to prototype a server plugin code in a scripting language called Lua (see http://www.lua.org).

Just write a Lua script using the API briefly described bellow, add it as a resource to the Lintouch Project, create new Lua connection while specifying this resource as its only property.

The following methods/variables are available from your Lua script.

  • variables

    is a global Lua table of all variables managed by the plugin; the table is indexed by variable name and contains lightweight userdata representing each variable

  • should_run()

    returns true as long as the plugin should be running

  • lock_requested_values()
  • trylock_requested_values()
  • unlock_requested_values()

    these functions provide access to the requested values mutex

  • lock_real_values()
  • trylock_real_values()
  • unlock_real_values()

    these functions provide access to the real values mutex

  • wait_for_new_requested_values( time_in_useconds )

    sleep for given amount of time while waiting whether the new requested values arrive; requested values should be locked beforehand; returns true when new requested values are available

  • get_requested_value( var )
  • set_requested_value( var, val )
  • is_requested_value_dirty( var )

    these functions provide access to the internals of requested value of a variable

  • get_real_value( var )
  • set_real_value( var, val )
  • is_real_value_dirty( var )

    these functions provide access to the internals of real value of a variable

  • sync_real_values()
  • sync_requested_values()

    clean dirty flags and synchronize real/requested values with the rest of the world