Frank Barknecht wrote:
Hallo, Claude Heiland-Allen hat gesagt: // Claude Heiland-Allen wrote:
Frank Barknecht wrote:
One thing I wanted to ask here: Is there a special reason that pdlua isn't using the (new in 5.1) vararg syntax with "..." for methods and maybe also in outlet(...) or similar places?
Yes. It makes it very difficult to do useful things with variable length inputs (such as iterating over them, storing them, etc).
See for example:
Thanks for this pointer. As I only write Lua for some weeks now, I may miss some things, but it seems to me, many of these issues aren't really a problem in pdlua's inlet and outlet messages, as these AFAIK will practically never contain "nil"-values. And if they don't contain nils, then the varargs can be converted to a table with {...} (or unpack'd from a table) on demand without running into problems with holes in tables coming from nils. And often, especially for inlet-methods, a full table may not even be needed to construct.
Yes, I see your point - but I feel the syntactic sugar is outweighed by the other reason why I used tables instead of varargs:
Lua's default stack size is small (45 slots or so, iirc), and Pd messages can be (almost) arbitrarily large. A table uses 1 stack slot, varargs uses 1 slot per element.