craniumkid22

IRC Functions

Mar 20th, 2013
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.21 KB | None | 0 0
  1. prizeTable = {"fat stacks of cash", "a solid gold toilet", "a brand new car", "tickets to that one awesome show"}
  2. deathTable = {"throwing them into a vat of acid", "burning them alive", "killing them with a turtle swarm", "eating their flesh"}
  3. answerTable = {"It is certain", "It is decidedly so", "Without a doubt", "Yes - definitely", "You may rely on it", "As I see it, yes", "Most likely", "Outlook good", "Yes", "Signs point to yes", "Reply hazy, try again", "Ask again later", "Better not tell you now", "Cannot predict now", "Concentrate and ask again", "Don't count on it", "My reply is no", "My sources say no", "Outlook not so good", "Very doubtful"}
  4. local seen={}
  5.  
  6. function win(nick, prize)
  7.     if not nick then nick = event["nick"] end
  8.     if not prize then prize = prizeTable[math.random(#prizeTable)] end
  9.     print(nick.." has won the internets. Please reward their awesomeness by giving them "..prize..".")
  10. end
  11.  
  12. function fail(nick, death)
  13.     if not nick then nick = event["nick"] end
  14.     if not death then death = deathTable[math.random(#deathTable)] end
  15.     print(nick.." has failed spectacularly. Please dispose of their wasted intelligence by "..death..".")
  16. end
  17.  
  18. function magicBall(question)
  19.     math.random(9001)
  20.     math.randomseed(math.random(1, 9001))
  21.     if not question then
  22.         print("You gaze into the swirling depths of the ethereal, and project your question into the all knowing crystal ball.")
  23.     else
  24.         print([[You ask the crystal ball, "]]..question..[[?"]])
  25.     end
  26.     print("As the fog lifts, you see an answer written in the wispy lines of smoke swirling about you: "..answerTable[math.random(#answerTable)]..".")
  27. end
  28.  
  29. function craniumExplore(t)
  30.     local indexTable = {}
  31.     for i, v in pairs(t) do
  32.         table.insert(indexTable, "Type = "..type(v).." ; Index = "..i.." ; Value = "..tostring(v))
  33.     end
  34.     return "Exploration: "..table.concat(indexTable, " // ")
  35. end
  36.  
  37. function explore2(t,i)
  38.     local seen={}
  39.     local function dump(t, i)
  40.         seen[t]=true
  41.         local s={}
  42.         local n=0
  43.         for k in pairs(t) do
  44.             n=n+1 s[n]=k
  45.         end
  46.         table.sort(s)
  47.         for k,v in ipairs(s) do
  48.             print(i,v)
  49.             v=t[v]
  50.             if type(v)=="table" and not seen[v] then
  51.                 dump(v,i.."\t")
  52.             end
  53.         end
  54.     end
  55. end
Advertisement
Add Comment
Please, Sign In to add comment