mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 21:53:46 +03:00
Upload
This commit is contained in:
36
lua/includes/extensions/coroutine.lua
Normal file
36
lua/includes/extensions/coroutine.lua
Normal file
@@ -0,0 +1,36 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
--
|
||||
-- The client needs this file
|
||||
--
|
||||
AddCSLuaFile()
|
||||
|
||||
if ( !coroutine ) then return end
|
||||
|
||||
--
|
||||
-- Name: coroutine.wait
|
||||
-- Desc: Yield's the coroutine for so many seconds before returning.\n\nThis should only be called in a coroutine. This function uses CurTime() - not RealTime().
|
||||
-- Arg1: number|seconds|The number of seconds to wait
|
||||
-- Ret1:
|
||||
--
|
||||
function coroutine.wait( seconds )
|
||||
|
||||
local endtime = CurTime() + seconds
|
||||
while ( true ) do
|
||||
|
||||
if ( endtime < CurTime() ) then return end
|
||||
|
||||
coroutine.yield()
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user