On 13.04.2012 16:12, Petr Bena wrote:
I have no knowledge of Lua, but I don't see what is problem with print here, the function print is supposed to print output to output device in most of programming languages, just as in this case, so I don't understand why we should want to use return (which is supposed to return some data / pointer back to function it was called from) in this case? I mean if we can pick if we should use print or return as recommended way to print text, I would vote for print(), especially if it has better performance that the implementation using return.
output buffer has to be "catched", while return value may be more complex than just a text, being processed via API or another way. Not all of the scripts should generate plain text. My extension will need nested arrays (or simple objects) to process, some of another extensions probably too. Dmitriy