Store Utility Module

There are many integration problems for which it is very useful to store and retrieve values in a persistent storage mechanism. The embedded SQLite engine in Iguana 5.0.7 onwards provides a very convenient way to implement such a store.

The module given here has a really easy to use interface, it’s just a matter of putting store = require 'store' at the top of your code and then you can jump in and use it like this:

To make it easier for you the store module includes help for all its functions:

Under the hood what this module does is create a SQLite database called ‘store.db’ in the working directory of Iguana which has a table called ‘store’ which has the name=value pairs. You don’t need to understand it’s internals to use it how ever. Just create a store module, download the code from our code repository, paste it into the module, and it will all work automatically:


Here is the sample code for you to play with:

store = require 'store'

function main()
   store.put('LastCompanyCheck', '199901012100')

   -- if more than 1 row in store then reset
   store.getTableState() -- check store before
   if  #store.getTableState() > 1 then
   store.getTableState() -- check store after

Download the latest version of the store.lua module from our code repository

See also:

Leave A Comment?

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.