lua-users home
lua-l archive

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


Here is a program that extracts the scrips that Roberto posted today.

 T=read"*a".."============="
 gsub(T,"=+\n(-- (%w+%.lua).-\n)=",function (a,f)
  print('x',f)
  assert(writeto(f))
  write(a)
  writeto()
  end)

To run, save this script into a file, say a.lua, and then do
	lua a.lua < suite.lua
where suite.lua is the file Roberto posted.

For those interested in simple Lua scripts, the program above is a typical
Lua script that processes text by reading it all in memory and then do whatever
is needed with gsub. Note how the text of each script and the name of the
script are both found using pattern matching.

Enjoy.
--lhf