[NTG-context] lpeg splitter

Hans Hagen pragma at wxs.nl
Fri Aug 5 16:44:59 CEST 2011


On 5-8-2011 4:37, Peter Rolf wrote:
> Hi,
>
> I'm currently trying to adapt my MP specials to the 'new' plugin
> handler. My actual problem is the splitting of the 'ssh_colors' string
> with lpeg. Sadly my knowledge about lpeg is nearly zero and it would
> take me a few days to understand this (my mind is already contaminated
> with 'regular expressions').
>
> How do I split the 'ssh_colors' string
>
>   ["ssh_colors"]="1:1:0 0.949:0.729:0 0.894:0.514:0 0.835:0.341:0
> 0.776:0.216:0 0.706:0.125:0 0.631:0.063:0.588 0.549:0.027:0.953
> 0.443:0.008:0.953 0.318:0:0.588 0:0:0",
>
> to get the single color strings (r:g:b) in say 'col[i]'?

inspect(lpeg.match(lpeg.tsplitat(" "),ssh_colors))


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the ntg-context mailing list