Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tarantoolctl rocks vs luarocks? #45

Closed
kevpie opened this issue Feb 10, 2018 · 1 comment
Closed

tarantoolctl rocks vs luarocks? #45

kevpie opened this issue Feb 10, 2018 · 1 comment

Comments

@kevpie
Copy link

kevpie commented Feb 10, 2018

Trying to use the docker image and it seems broken.

When I connect to the console require('mysql') doesn't load the rock.

unix/:/var/run/tarantool/tarantool.sock> local mysql = require('mysql')
---
...

unix/:/var/run/tarantool/tarantool.sock> local pool = mysql.pool_create({ host = '127.0.0.1', user = 'user', password = 'password', db = 'db', size = 5 })
---
- error: '[string "local pool = mysql.pool_create({ host = ''127...."]:1: attempt
    to index global ''mysql'' (a nil value)'
...

When I logon to the container via /bin/sh

tarantoolctl rocks list shows nothing

~ # tarantoolctl rocks list

Installed rocks:
----------------

luarocks list shows all the bundled rocks

~ # luarocks list

Installed rocks:
----------------

avro-schema
   2.0.1-1 (installed) - /usr/local/lib/luarocks/rocks

connpool
   1.1.1-1 (installed) - /usr/local/lib/luarocks/rocks

expirationd
   1.0.1-1 (installed) - /usr/local/lib/luarocks/rocks

gis
   1.0.0-1 (installed) - /usr/local/lib/luarocks/rocks

gperftools
   1.0.1-1 (installed) - /usr/local/lib/luarocks/rocks

http
   1.0.1-1 (installed) - /usr/local/lib/luarocks/rocks

ldoc
   1.4.6-2 (installed) - /usr/local/lib/luarocks/rocks

lua-term
   0.7-1 (installed) - /usr/local/lib/luarocks/rocks

luafilesystem
   1.7.0-2 (installed) - /usr/local/lib/luarocks/rocks

markdown
   0.33-1 (installed) - /usr/local/lib/luarocks/rocks

memcached
   1.0.0-1 (installed) - /usr/local/lib/luarocks/rocks

mqtt
   1.2.1-1 (installed) - /usr/local/lib/luarocks/rocks

mysql
   2.0.1-1 (installed) - /usr/local/lib/luarocks/rocks

penlight
   1.5.4-1 (installed) - /usr/local/lib/luarocks/rocks

pg
   2.0.1-1 (installed) - /usr/local/lib/luarocks/rocks

prometheus
   1.0.0-1 (installed) - /usr/local/lib/luarocks/rocks

queue
   1.0.2-1 (installed) - /usr/local/lib/luarocks/rocks

shard
   scm-1 (installed) - /usr/local/lib/luarocks/rocks

tarantool-curl
   2.3.1-1 (installed) - /usr/local/lib/luarocks/rocks

Trying to move forward with testing. Please advise.

@kevpie
Copy link
Author

kevpie commented Feb 11, 2018

Since I'm brand new to lua, I learned this as one does, the hard way.

Found my answer here...
http://lua-users.org/wiki/ScopeTutorial

Why are local variables difficult in the interactive interpreter
Because it runs each line in a new scope:

> local a=5; print(a)
5
> print(a) -- a is out of scope now, so global a is used
nil

If I don't assign to local scope everything is working.

@kevpie kevpie closed this as completed Feb 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant