LUA CallBack with TimeT type
I'm trying to process time with LUA parser. I'm not able to set callback for meta with the type "TimeT" (nwtypes.TimeT).
If my code look like :
[nwlanguagekey.create("time", nwtypes.TimeT)] = compare_times.getTime,
I get this error :
NwLogDecoder: [Parse] [failure] Meta processing failed for session with: Bad cast
From my undestanding TimeT is an 8 bytes type, I've tried to use Unint8 unstead but callback does not work.
Thanks in advance for you advice.
The time meta format is TimeT so your declaration should be correct. Depending on the parser logic, you may try to only register the time meta without running the getTime function and see if the time meta is registered correctly. You can enable detailed stats from Decoder Explore -> parsers -> config -> detailed.stats=yes and this will show all the metas each parser registered in the stats. This change should be done for debugging only because it is expensive in processing.
thanks a lot for you answser and the debuggin tips.
What do you mean by "only register withour running getTime function" ?
I 've tried with empty function, it look like the function doese not take the right argument type. It register correctly if I override the type by forcing Unint8 but the callback doese not work.
I have tested the details stats. In my LUA parser I register 2 meta for Callback. And in stats there is 2 meta shown as callback so it seems correct.
Many thanks in advance.
As far as I know the bad cast error is happening because internally TimeT is a 64 bit integer while the lua engine currently in use only supports 32 bit integer, hence the error. My understaning (but I'd be happy to be wrong) is that until the lua engine will be upgraded, you cannot really deal with TimeT meta keys.
Thanks for your answer ! My lua seems to be compiled as 64 bit.
/usr/bin/lua: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped
Maybe I can somhow cast it to Unint64 , what do you think ?
Thanks in advance.
Lua as used by the parsing engine is compiled into the parsing engine (LuaJIT, specifically). It doesn't use the lua executable at /usr/bin/lua. LuaJIT itself is based on Lua 5.1.
There's really no way to work with a TimeT in a lua parser.
Thanks William,too bad...
so i'll search for another way to achieve this.
Do you now if time comparison is supported by apprule ?
I want to compare metas : time and event_time ( getter than or lower than).
Thanks in advance.
what do you think about mapping event_time and time to a new metas with uint64 type (Transiente one) and use it in the LUA parser ?
Thanks in advance