MattiasBuelens

Common program

Jun 26th, 2012
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.44 KB | None | 0 0
  1. --[[
  2.  
  3.     Common utilities
  4.     Program base
  5.  
  6. --]]
  7.  
  8. program = {
  9.     directory = shell.resolve("/"..shell.getRunningProgram().."/..")
  10. }
  11.  
  12. function program.load(...)
  13.     for i,relativePath in ipairs({...}) do
  14.         local currentDir = program.directory
  15.         local filePath = fs.combine(currentDir, relativePath)
  16.         local fileDir = shell.resolve("/"..filePath.."/..")
  17.  
  18.         program.directory = fileDir
  19.         dofile(filePath)
  20.         program.directory = currentDir
  21.     end
  22. end
Advertisement
Add Comment
Please, Sign In to add comment