|
Personally, I found my solution to this itch :) with the "%" operator usage that was mentioned on the list only a few weeks back. It is common to all Lua strings, but does not break current behaviour, nor needs core-level changes. I love it! :)
Instead of this, I would recommend using one of the operators currentlyundefined for strings (it could be the % operator, say) and use it tointerpolate values from a table. This is done by detecting placeholders inthe string. For example:- "Name: [1], Rank: [2], Serial: [3]" % {"Andy", "Captain", 1234}Of course it doesn't have to use square brackets. One possibility is to use % within the string like printf does - familiar and consistent withthe choice of operator.
by Andy Stark, Oct 9th. Luiz Henrique de Figueiredo kirjoitti 23.10.2006 kello 20.35:
This transformation can be done by the parser, rather than processing itat runtime.Another fine job for a token filter... --lhf