added compat 5.1 license copied from website
[rrdtool.git] / bindings / lua / README
1 RRDLua is a Lua module for RRD functions.
2
3 - Configuration
4
5   From the top dir of RRDtool package, run "./configure", or
6   "./configure --enable-lua-site-install" if you prefer to install in
7   Lua's search path.
8
9  You should have lua 5.0, or superior, and respective lua-dev packages
10  installed before executing configure.
11
12 - Compilation and installation
13
14  Run 'make' and 'sudo make install'. If you don't enable lua-site-install,
15  the Lua modules will be installed together with RRDtool, under the subdir
16  <INSTALL_PREFIX>lib/lua/<lua_version>.
17
18 - Testing
19
20  Install RRDtool first, as above. Then, enter the bindings/lua dir, run
21  'make test' and use your preferred viewer to display the just created
22  'test.png'. If you can read "Enjoy Lua RRDtool module!" on the picture,
23  everything went fine.
24
25 - Using with Lua 5.1
26
27  Start your programs with:
28
29   ------..-----------------------------------------------------------
30   package.cpath = '<INSTALL_PREFIX/lib/lua/5.1/?.so;' ..
31                   package.cpath
32   require 'rrd'
33   -------------------------------------------------------------------
34
35  OBS: If you use the option --enable-lua-site-install you won't need
36       to change package.cpath like above. 
37
38 - Using with Lua 5.0
39
40  The Lua binding for RRDtool needs the compat-5.1 module to work with
41  Lua 5.0. Some Linux distros, like Ubuntu gutsy and hardy, have it
42  already integrated in Lua 5.0 -dev packages, so you just have to
43  require:
44
45   require 'compat-5.1'
46
47  For other platforms, the compat-5.1 module that comes with this Lua
48  binding will be installed for you in the same dir where RRDtool was
49  installed, under the subdir .../lib/lua/5.0. In this case, you must
50  tell your Lua programs where to find it by changing the Lua var
51  LUA_PATH:
52
53   --- compat-5.1.lua is only necessary for Lua 5.0 ------------------
54   original_LUA_PATH = LUA_PATH
55   -- try only compat-5.1 installed with RRDtool package
56   LUA_PATH = '<INSTALL_PREFIX>/lib/lua/5.0/?.lua'
57   require 'compat-5.1'
58   LUA_PATH = original_LUA_PATH
59   original_LUA_PATH = nil
60   --- end of code to require compat-5.1 -----------------------------
61
62   Now we can require the rrd module just like we did for 5.1 above:
63
64   -------------------------------------------------------------------
65   package.cpath = '<INSTALL_PREFIX>/lib/lua/5.0/?.so;' ..
66                   package.cpath
67   require 'rrd'
68   -------------------------------------------------------------------