Execute a Lua Script
Execute an ad hoc Lua script, see the Lua methods documentation for more details
:POST db/{graph}/lua
Example Request:
:POST /db/rage/lua Request Body: "script"
The script must end in one or more values that will be returned in JSON format inside an Array.
Within the script the user can access to graph functions. For example:
a = NodeGetId("Node","Max")
b = NodeTypesGetCount()
c = NodeTypesGetCountByType("Node")
d = NodePropertyGet("Node", "Max", "name")
e = NodePropertyGetById(a, "name")
a, b, c, d, e
Another example to get the names of the nodes related to Node Max:
names = {}
ids = NodeGetRelationshipsIds("Node", "Max")
for k=1,#ids do
v = ids[k]
table.insert(names, NodePropertyGetById(v.node_id, "name"))
end
names