I'm curious, is this an oversight or an intentional decision to not support tables?<raiseEvent: bad argument #2 type (string, number, boolean, or nil expected, got a table!)>
raiseEvent works with everything but tables?
raiseEvent works with everything but tables?
I was expecting to write an event handler that accepted a table, to avoid a long function declaration however...
-
- Posts: 334
- Joined: Thu Mar 05, 2015 2:53 am
Re: raiseEvent works with everything but tables?
I don't know if it was intentional or not, but it can be worked with using the function pair yajl.to_string / yajl.to_value
These function encode a table into a usable string, and decode the string back into a table.
These function encode a table into a usable string, and decode the string back into a table.
Re: raiseEvent works with everything but tables?
Yeah table serialisation can get tricky - remember even a function is a first-class citizen in Lua a valid member of a table. Go with the serialisation Nyyrazzilyss proposed if you don't want to split your data into arguments for the event.
- SlySven
- Posts: 1023
- Joined: Mon Mar 04, 2013 3:40 pm
- Location: Deepest Wiltshire, UK
- Discord: SlySven#2703
Re: raiseEvent works with everything but tables?
Phew the type detection code did it's job and spotted a table - - Yeah! Wot the others said - the code to past a table through the Event code would be more complicated than I would be willing (or understand enough about ) to do...