Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Coroutine Usage
- -- https://www.lua.org/pil/9.html
- -- Main function:
- function main()
- Wait(450)
- -- Min and Max number:
- local Min,Max = 1,10
- -- Number:
- Number = coroutine.create(function()
- for n = Min,Max + 1 do
- -- Print:
- TextPrintString(tostring(n),1,2)
- -- Reset:
- if n == Max then
- n = Min - 1
- end
- -- Suspend:
- coroutine.yield()
- end
- end)
- -- Process:
- while true do
- if IsButtonBeingPressed(3,0) then
- -- Resume:
- local IsValid,Select = coroutine.resume(Number)
- end
- Wait(0)
- end
- end
Add Comment
Please, Sign In to add comment