You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
define stored lua procedure in your init.lua (or another lua module) loaded in tarantool.
For instance
function name2id(name)
local id = 42
return id // result is scalar value here
end
use Call to get the result
resp, err := connection.Call("name2id", []interface{}{ "users" })
if err != nil {
return err
}
uid := resp.Data[0].([]interface{})[0].(uint64) // Data is table of 1 tuple of 1 element here
For example, I have this lua script for determining name of box.space by id:
tnt.Eval("box.space." + spaceIdStr + ".name", []interface{}{})
It seems to be ugly and error prone way. So how can I pass some data to lua and how to use this data as lua varable(s)?
The text was updated successfully, but these errors were encountered: