AFRLme

divo: How to Load/Include An External Script File [VS]

Jan 10th, 2013
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.45 KB | None | 0 0
  1. -- * load an external script file if the file exists! * --
  2. function loadScripts()
  3.   local f, cerror
  4.  
  5.   f, cerror = loadfile('./folder_name/script_name.lua') -- replace folder_name & script_name with whatever you called your folders & script!
  6.   if f == nil then -- checks if file exists!
  7.     print('cerror: ' .. cerror) -- prints error reason to the log file!
  8.   else
  9.     print('External script(s) have been successfully loaded!')
  10.     f()
  11.   end
  12. end
Advertisement
Add Comment
Please, Sign In to add comment