home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Inne / Gry / Enigma / Enigma-1.01-w7.exe / reference / xml2lua < prev   
Encoding:
Lua script  |  2009-12-13  |  536 b   |  21 lines

  1. #!/usr/bin/env lua
  2. -- Simple converter for Enigma xml (utf-8) level to lua level
  3. -- Copyright (c) 2006 Ronald Lamprecht
  4. -- License: GPL2
  5. -- Usage: lua xml2lua.lua level.xml > level.lua
  6. -- Requires Lua 5.0 or above
  7. stdout = io.output()
  8. xml = true
  9. for line in io.lines(arg[1]) do
  10.     if (string.find(line,"]]>",1,true) ~= nil) then
  11.         xml = true
  12.     end
  13.     if xml then
  14.         stdout:write("--xml-- ")
  15.     end
  16.     stdout:write(line .. "\n" )
  17.     if (string.find(line,"<![CDATA[",1,true) ~= nil) then
  18.         xml = false
  19.     end
  20. end
  21.