Advertisement
1lann

compiler

Sep 17th, 2012
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.51 KB | None | 0 0
  1. local tArgs = {...}
  2. if tArgs then
  3. if #tArgs ~= 2 then
  4.     print("Usage: compile program saveto")
  5. elseif not fs.exists(tArgs[1]) then
  6.     print("Program file does not exist")
  7. elseif fs.exists(tArgs[2]) then
  8.     print("Save-to file already exists")
  9. else
  10.     print("Compiling...")
  11.     local startCompiledProgram = loadfile(tArgs[1])
  12.     local toWrite = string.dump(startCompiledProgram)
  13.     f = io.open(tArgs[2], "w")
  14.     f:write(toWrite)
  15.     f:close()
  16.     print("Program compiled!")
  17. end
  18. else
  19. print("Usage: compile program saveto")
  20. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement