X-Git-Url: https://git.octo.it/?p=rrdtool.git;a=blobdiff_plain;f=bindings%2Flua%2FREADME;h=0eaacccc8144342dd375ba3b6bb3568b96549afc;hp=f1fe18619a0f7057d407e05134735e4aa31b4be0;hb=e0fde57e050da8ae29bf1a95aee958dfff2510e2;hpb=e47fa689bece818faa3bd6f4bea4eca22cd517a7 diff --git a/bindings/lua/README b/bindings/lua/README index f1fe186..0eaaccc 100644 --- a/bindings/lua/README +++ b/bindings/lua/README @@ -1,21 +1,69 @@ RRDLua is a Lua module for RRD functions. -Compiling: +- Configuration -Just run "configure" from the top RRDTool package dir and then 'make'. -You should have lua and lua-dev packages installed before executing -configure. + From the top dir of RRDtool package, run "./configure", or + "./configure --enable-lua-site-install" if you prefer to install it + in Lua's search path. -Testing: + You should have lua and lua-dev packages installed before executing + configure. -Enter the bindings/lua dir, run 'make test' and use your preferred -viewer to display the just created graph 'test.png'. If you can read -"Enjoy Lua RRDtool module!" on the picture, everything went fine. +- Compilation and installation -Installation: + Run 'make' and 'sudo make install'. If you don't enable lua-site-install, + the Lua module will be installed together with RRDtool, under the subdir + lib/lua/. -Run 'make install' from the top dir of the RRDtool package. The Lua -module will be installed in the same RRDtool installation dir, -under the subdir lib/lua/. +- Testing + Install RRDtool first, as above. Then, enter the bindings/lua dir, run + 'make test' and use your preferred viewer to display the just created + 'test.png'. If you can read "Enjoy Lua RRDtool module!" on the picture, + everything went fine. + +- Using with Lua 5.1 + + Start your programs with: + + --------------------------------------------------------------- + package.cpath = '/usr/local/rrdtool-1.3.2/lib/lua/5.1/?.so;' .. + package.cpath + require 'rrd' + --------------------------------------------------------------- + + OBS: If you use the option --enable-lua-site-install you won't need + to change package.cpath like above. + +- Using with Lua 5.0 + + The Lua binding for RRDtool needs the compat-5.1 module to work with + Lua 5.0. Some Linux distros, like Ubuntu gutsy and hardy, have it + already integrated in Lua 5.0 -dev packages, so you just have to + require: + + require 'compat-5.1' + + For other platforms, the compat-5.1 module that comes with this Lua + binding will be installed for you in the same dir where RRDtool was + installed, under the subdir .../lib/lua/5.0. In this case, you must + tell your Lua programs where to find it by changing the Lua var + LUA_PATH: + + --- compat-5.1.lua is only necessary for Lua 5.0 ---------------- + original_LUA_PATH = LUA_PATH + -- try only compat-5.1 installed with RRDtool package + LUA_PATH = '/usr/local/rrdtool-1.3.2/lib/lua/5.0/?.lua' + require 'compat-5.1' + LUA_PATH = original_LUA_PATH + original_LUA_PATH = nil + --- end of code to require compat-5.1 --------------------------- + + Now we can require the rrd module in the same way we did for 5.1 above: + + --------------------------------------------------------------- + package.cpath = '/usr/local/rrdtool-1.3.2/lib/lua/5.0/?.so;' .. + package.cpath + require 'rrd' + ---------------------------------------------------------------