Advertisement
justync7

derp

May 15th, 2013
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.57 KB | None | 0 0
  1. function split(str, pat)
  2.    local t = {}  -- NOTE: use {n = 0} in Lua-5.0
  3.    local fpat = "(.-)" .. pat
  4.    local last_end = 1
  5.    local s, e, cap = str:find(fpat, 1)
  6.    while s do
  7.       if s ~= 1 or cap ~= "" then
  8.          table.insert(t,cap)
  9.       end
  10.       last_end = e+1
  11.       s, e, cap = str:find(fpat, last_end)
  12.    end
  13.    if last_end <= #str then
  14.       cap = str:sub(last_end)
  15.       table.insert(t, cap)
  16.    end
  17.    return t
  18. end
  19.  
  20. while true do
  21. event, data =os.pullEvent("mag_swipe")
  22. arg=split(data," ")
  23. shell.run(unpack(arg))
  24. print("Done!")
  25. error()
  26. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement