Advertisement
Bolodefchoco_LUAXML

[Function] system.setRoom

Mar 9th, 2017
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.78 KB | None | 0 0
  1. --Creator: Bolodefchoco
  2. --Made in: 09/03/2017
  3. --Last update: 09/03/2017
  4.  
  5. system.roomSettings = {
  6.     ["@"] = function(value)
  7.         -- /room #test1234@Tigrounette
  8.         print(value .. " is noob!")
  9.     end,
  10. }
  11.  
  12. system.module = "test"
  13. system.isRoom = tfm.get.room.name:byte(2) ~= 3
  14. system.roomAttributes = system.isRoom and tfm.get.room.name:match("%*?#".. system.module .. "%d+(.*)") or nil
  15.  
  16. system.setRoom = function()
  17.     if system.isRoom and system.roomAttributes then
  18.         local chars = ""
  19.         for k in next,system.roomSettings do
  20.             chars = chars .. k
  21.         end
  22.        
  23.         for char,value in system.roomAttributes:gmatch("(["..chars.."])([^"..chars.."]+)") do
  24.             for k,v in next,system.roomSettings do
  25.                 if k == char then
  26.                     v(value)
  27.                     break
  28.                 end
  29.             end
  30.         end
  31.     end
  32. end
  33.  
  34. system.setRoom()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement