commands.lua 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. Commands = {
  2. cls = {
  3. fun = function(console)
  4. console.logs = {}
  5. console.scroll_to_bottom = true
  6. end,
  7. help = "Clears the log"
  8. },
  9. help = {
  10. fun = function(console, fun)
  11. if fun then
  12. if console.command_helps[fun] then
  13. console:log(fun .. " " .. console.command_helps[fun])
  14. elseif console.commands[fun] then
  15. console:log(fun.." doesn't have help info.")
  16. else
  17. console:log("Command not found : "..fun)
  18. end
  19. return
  20. end
  21. local res = ""
  22. for k,v in pairs(console.commands) do
  23. res = res .. k .. " "
  24. end
  25. console:log(res)
  26. end,
  27. help = "[fun] : List commands or show help of a given command."
  28. },
  29. collectgarbage = {
  30. fun = function(console, opt, arg)
  31. collectgarbage(opt, arg)
  32. end,
  33. help = "[opt][, arg] : calls lua's collectgarbage'"
  34. }
  35. }
  36. -- Aliases
  37. Commands.ls = Commands.help
  38. return Commands