init.lua 605 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. local lynx = {}
  2. local path = (...) .. "."
  3. -- Backup old require to replace it with a custom local one.
  4. local _require = require
  5. function require (mod)
  6. return lynx[mod] or _require(mod)
  7. end
  8. -- All loaded modules, should contain all required stuff.
  9. -- Must to be ordered properly.
  10. local modules = {
  11. -- Base items
  12. "classic",
  13. "menu",
  14. "item",
  15. -- Advanced items
  16. "text",
  17. "button",
  18. "slider",
  19. "observer",
  20. "list",
  21. -- Other things
  22. "love_lynx",
  23. "raylua_lynx"
  24. }
  25. -- Load stuff.
  26. for i=1,#modules do
  27. lynx[modules[i]] = _require(path .. modules[i])
  28. end
  29. require = _require
  30. return lynx