lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> >Eg., we can just manually tinsert the strings to a given table, 
> and call a
> >function to collate them in a resulting string.
> 
> A "concat" function is planned to be added to the standard string library.
> It would receive a table and perhaps an optional string 
> separator, to be added
> between the strings in the table. Of course, "concat" would be implemented
> using lua_concat (which can concat several strings at once), perhaps using
> the buffer functions in lauxlib.

Excellent, so my ideas wheren't so whacky after all :-)
It is not in my copy of the 4.1-alpha, so either it is not yet implemented,
or not yet released.

> >The drawback of this solution is that you can call the collate 
> function with
> >any table, including one with tables or functions in it, or 
> hashes, which is
> >inappropriate. The behavior in this case is to be defined: either just
> >ignore the incorrect entries, or make the function fails and returns nil.
> 
> The behavior in this case would be same as in ordinary Lua concat 
> expressions,
> ie, tag methods would be called if set.

I should have though of that, I haven't used tag methods yet, so I don't
think about them much...
I should, these tag methods are quite powerful indeed.

Regards.

-- 
--._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.--
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/
--´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`--

Sent through GMX FreeMail - http://www.gmx.net