Raised This Month: $ Target: $400
 0% 

No #base or #include in config files?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
soccermitchy
New Member
Join Date: Feb 2014
Old 02-08-2014 , 21:57   Re: No #base or #include in config files?
Reply With Quote #4

So, I just wrote a preprocessor script that does this for me in Lua.
Code:
if not arg[1] then error "No template file given." end
print("Generating tf2items configuration from "..arg[1])
local finishedFile = ""
function parse(file)
  local out=""
  for line in io.lines(file) do
    if line:match("[ \t]+#inc \"(.+)\"") then
      print("included file: "..line:match("[ \t]+#inc \"(.+)\""))
      out=out..parse(line:match("[ \t]+#inc \"(.+)\""))
    else
      out=out..line.."\n"
    end
  end
  return out
end
finishedFile=parse(arg[1])
print("Done generating output.")
f=io.open("tf2items.weapons.txt","w")
f:write(finishedFile)
f:close()
Run it with lua script.lua template.txt
where a template is like a normal config file but lets you include files with #inc "filename"

Last edited by soccermitchy; 02-08-2014 at 21:58.
soccermitchy is offline
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:30.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode