Bolodefchoco_LUAXML

[Script] infcoroutine

Dec 25th, 2016
339
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.59 KB | None | 0 0
  1. --Creator: Bolodefchoco
  2. --Made in: 25/12/2016
  3. --Last update: 25/12/2016
  4.  
  5. infcoroutine = setmetatable({},{
  6.     __newindex = function(list,index,value)
  7.         if type(value) == "function" then
  8.             rawset(list,index,setmetatable({value},{
  9.                 __call = coroutine.wrap(function(t,...)
  10.                     t[1] = coroutine.create(value)
  11.                     while true do
  12.                         if coroutine.status(t[1]) == "dead" then
  13.                             t[1] = coroutine.create(value)
  14.                             coroutine.resume(t[1],...)
  15.                         end
  16.                         coroutine.resume(t[1],...)
  17.                         coroutine.yield()
  18.                     end
  19.                 end)
  20.             }))
  21.         else
  22.             rawset(list,index,value)
  23.         end
  24.     end
  25. })
Advertisement
Add Comment
Please, Sign In to add comment