[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: gremlin in Lua
- From: Jak Sprats <jaksprats@...>
- Date: Sun, 4 Mar 2012 11:37:01 -0300
Thanks Robert & Xavier,
I did not think the exact gremlin's exact syntax was possible in Lua, so thanks for confirming that.
I will probably do something like "g:v(1):out('knows'):filter [[age < 30]]", seems very Lua-esque and not too far from Gremlin.
These gremlin calls may be made repetitively, so I may also try to be smart and turn [[age<30]] into a real function for repetitive calls
thanks,
jak
>>what about this:
>>g:v(1):out('knows'):filter [[age < 30]]
>>use : to replace . to get native lua OO support, and pass a string to
>>filter, in a filter you can do this:
>>function filter(self, chunk)
>> local f = assert(load("return function(_ENV) return "..chunk.."end"))()
>> -- used like this:
>> -- if f(it) then ... end
>>end