helpers.rb 328 B

12345678910111213141516
  1. # Loads a script file once only. Uses a global
  2. # variable $scripts_loaded to keep track of all names of loaded scripts.
  3. def script_once(filenname)
  4. $scripts_loaded ||= {}
  5. if $scripts_loaded[filename]
  6. return 0
  7. end
  8. res = script(filename)
  9. if res == 0
  10. $scripts_loaded[filename] = true
  11. end
  12. return res
  13. end