A plotting library for Lua based on IUP to create plots using the standard Lua Interpreter. The plots are managed by a separate thread and don't block the interpreter.
lp=require("lua-plot")
p=lp.plot{}
p:Show() -- shows a blank plotp:AddSeries({ {1,1},{2,2},{3,3} })
p:Redraw()
-- The graph can be closed at this point by closing the window pressing the cross buttonp:Show() -- shows the graph again.lp.listPlots() -- displays the list of plots maintained locally and by the plotserver ( should be just 1)p=nil-- will cause the graph to be garbage collectedlp.listPlots() -- will show no plots left
In a Lua shell and while I had installed all the dependencies listed here I got the error:
>lp=require("lua-plot")
>p=lp.plot{}
stdin:1: attempttoindexabooleanvalue (global'lp')
stacktraceback:
stdin:1: inmainchunk
[C]: in ?
>p:Show() -- shows a blank plotstdin:1: attempttoindexanilvalue (global'p')
stacktraceback:
stdin:1: inmainchunk
[C]: in ?
>p:AddSeries({ {1,1},{2,2},{3,3} })
stdin:1: attempttoindexanilvalue (global'p')
stacktraceback:
stdin:1: inmainchunk
[C]: in ?
>p:Redraw()
stdin:1: attempttoindexanilvalue (global'p')
stacktraceback:
stdin:1: inmainchunk
[C]: in ?
>-- The graph can be closed at this point by closing the window pressing the cross button>p:Show() -- shows the graph again.stdin:1: attempttoindexanilvalue (global'p')
stacktraceback:
stdin:1: inmainchunk
[C]: in ?
>lp.listPlots() -- displays the list of plots maintained locally and by the plotserver ( should be just 1)stdin:1: attempttoindexabooleanvalue (global'lp')
stacktraceback:
stdin:1: inmainchunk
[C]: in ?
>p=nil-- will cause the graph to be garbage collected>lp.listPlots() -- will show no plots leftstdin:1: attempttoindexabooleanvalue (global'lp')
stacktraceback:
stdin:1: inmainchunk
[C]: in ?
as you can see the issue really started when p was first defined. Any ideas what the problem is? I should mention that I had disabled the use of llthreads due to #1.
The llthreads dependency seems to be required incorrectly as I have installed the llthreads2 (version 0.1.4) from the repository you linked in the documentation. It installs its crucial library to /usr/lib/lua/5.3/llthreads2.so with llthreads2.so being the notable part of that path. When I symlink this path to /usr/lib/lua/5.3/llthreads.so I get yet another error when I try to load lua-plot:
error loading module 'llthreads' from file '/usr/lib/lua/5.3/llthreads.so':
/usr/lib/lua/5.3/llthreads.so: undefined symbol: luaopen_llthreads
stack traceback:
[C]: in?
[C]: infunction'require'
/usr/share/lua/5.3/lua-plot.lua:21: in main chunk
[C]: infunction'require'
stdin:1: in main chunk
[C]: in?> lp = require("lua-plot")
/usr/share/lua/5.3/lua-plot.lua:21: module 'llthreads' not found:
no field package.preload['llthreads']
no file '/usr/share/lua/5.3/llthreads.lua'
no file '/usr/share/lua/5.3/llthreads/init.lua'
no file '/usr/lib/lua/5.3/llthreads.lua'
no file '/usr/lib/lua/5.3/llthreads/init.lua'
no file './llthreads.lua'
no file './llthreads/init.lua'
no file '/usr/lib/lua/5.3/llthreads.so'
no file '/usr/lib/lua/5.3/loadall.so'
no file './llthreads.so'
stack traceback:
[C]: infunction'require'
/usr/share/lua/5.3/lua-plot.lua:21: in main chunk
[C]: infunction'require'
stdin:1: in main chunk
[C]: in?
If I disable the use of llthreads by editing line 17 of lua-plot.lua changing nil to 1 everything works, fine, however. So it is clearly with what's done with llthreads. If relevant my platform is Arch Linux and I installed llthreads2 with this PKGBUILD:
pkgname=lua-llthreads2
pkgver=0.1.4
pkgrel=1
pkgdesc="This is full dropin replacement for llthreads library"
arch=("i686""x86_64")
url="http://github.com/moteus/lua-llthreads2/"
license=("MIT")
depends=("lua")
makedepends=("luarocks")
source=("$pkgname-$pkgver.tar.gz::https://github.com/moteus/$pkgname/archive/v$pkgver.tar.gz")
md5sums=('b76af7ef6970b0e8089472fe377d3757')
build() {
cd"$srcdir/$pkgname-$pkgver"
luarocks make --pack-binary-rock "rockspecs/$pkgname-$pkgver-1.rockspec"
}
package() {
cd"$srcdir/$pkgname-$pkgver"
install -Dm755 llthreads2.so "$pkgdir/usr/lib/lua/5.3/llthreads2.so"
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}