Module pl.luabalanced

Extract delimited Lua sequences from strings.

Inspired by Damian Conway’s Text::Balanced in Perl.

  • [1] Lua Wiki Page
  • [2] http://search.cpan.org/dist/Text-Balanced/lib/Text/Balanced.pm

 local lb = require “pl.luabalanced”
 –Extract Lua expression starting at position 4.
  print(lb.match_expression(“if x2 + x > 5 then print(x) end”, 4))
  –> x2 + x > 5     16
 –Extract Lua string starting at (default) position 1.
 print(lb.match_string([[“test\"123” .. “more”]]))
 –> “test\"123”     12
 
© 2008, David Manura, Licensed under the same terms as Lua (MIT license).



generated by LDoc 1.4.6 Last updated 2017-07-18 16:28:41