Trunk Notes 2.6.2 - minor Lua change

I have just submitted a minor update to Trunk Notes. In addition to a long overdue fix to sound recording (and support for a compressed format for much smaller recordings) there has been a minor update to Lua.

Lua scripting now knows some basic information about the device it is running on. This was prompted by users asking whether they could have different CSS files for the iPad and  iPhone. With this new Lua feature it should be simple to add this with a little bit of scripting.

Here is the excerpt from the manual describing this new feature:

Lua has access to some information about the device Trunk Notes is running on. This can be useful for customizing your wiki depending on whether it is running on your iPhone or iPad.

A device table in the global environment has the following fields:

  • name – e.g. Matt’s iPad
  • systemName – e.g. iPhone OS
  • systemVersion – e.g. 5.1.1
  • model – e.g. iPad
  • localizedModel – if your locale defines a different name for the device.

For example:

if device.model == "iPad" then
return "This is an iPad!"
return "This is not an iPad"