View Single Post
Old 03-21-2016, 12:12 PM   #1
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Adding Lua support to KUAL-system

Very, very long past due, an update to the KUAL-system layout.
(Note: The BitBucket repository is still several years out-of-date.)
The new public repository is at: https://github.com/janetizzy/KUAL-buttons

Background
This adds the ability to use the series 5 device's built-in Lua with our own scripts and add-in modules.
Lua is a 'mid-level' scripting language, used in many situations where both scripting ability and performance is required (such as in games, WoW for one), see:
https://www.lua.org/about.html
The Timm Müller mentioned there is also one of the authors of the tekUI graphics package.
(Which has been adapted to the Kindles and is ready for testing, see:
https://www.mobileread.com/forums/sho...9&postcount=15
and following.


The series 5 devices have Lua included within the factory image because the Kindle's window manager is Awesome, which is configured and programed in Lua, see:
https://awesome.naquadah.org/

There is now a KUAL menu extension which uses Lua scripting that can serve as a working, worked, example, see: https://www.mobileread.com/forums/sho...d.php?t=271929
One of the things demonstrated there is the writing of the report in HTML that is compatible with the Kindle's native reader.

KOreader is also scripted in Lua, but it provides its own, embedded, just-in-time compiler rather than use the system provided interpreter.

Usage for script authors:
To make this work along with the factory supplied Lua and Lua modules requires two things:
*) In your 'button directory', along side the config.xml and menu.json files, add a copy of the esys.lua file attached below.
(This directory is the 'current working directory' while your scripts are running.)

*) As the top line of your script(s) that are being called from menu.json write:
Code:
#!/usr/bin/lua -lesys

-- Whatever you would otherwise write follows
Usage for users (other than script authors):
Ignore the esys.lua thing, the script author will include it with their button extension.
The other three, just un-zip the contents into the top of visible USB storage.

Installation (general):
Un-archive the three lua-base-* archives to the topmost level of visible USB storage.
If writing anything for this Kindle/Lua include the esys.lua file in whatever is the current working directory of your scripting and the splat-bang line as shown above as the first line of your script.

Attachments
The archives *.tar.gz and *.zip of the same basename, contain the same files.
Both formats are provided to ease the installation when using a PC to un-archive them.
The Kindle itself, has the software de-compressors installed to handle either format.

Just be sure that the un-archive tool you use:
*) Does not do EoL conversions
*) Un-archives to the directory structure contained in the archive
(the usual default)
*) That the tool is set to 'update' existing directories and files
(the usual default)
Attached Files
File Type: gz esys.lua.gz (689 Bytes, 351 views)
File Type: gz lua-base-posix.tar.gz (56.6 KB, 373 views)
File Type: gz lua-base-penlight.tar.gz (109.9 KB, 358 views)
File Type: zip lua-base-penlight.zip (131.5 KB, 335 views)
File Type: zip lua-base-posix.zip (59.9 KB, 323 views)
File Type: zip lua-base-md5.zip (5.7 KB, 302 views)
File Type: gz lua-base-md5.tar.gz (4.6 KB, 358 views)

Last edited by knc1; 04-15-2016 at 03:19 AM.
knc1 is offline   Reply With Quote