{"id":20345297,"url":"https://github.com/sniper00/lua_timer","last_synced_at":"2025-04-12T00:40:47.200Z","repository":{"id":47798759,"uuid":"75276201","full_name":"sniper00/lua_timer","owner":"sniper00","description":"Pure lua implements timer ,support coroutine(with coroutine pool optimized)","archived":false,"fork":false,"pushed_at":"2020-06-19T09:01:30.000Z","size":321,"stargazers_count":27,"open_issues_count":0,"forks_count":15,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-25T20:21:47.968Z","etag":null,"topics":["lua","luatimer","timer"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sniper00.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-01T09:23:50.000Z","updated_at":"2025-03-13T09:12:31.000Z","dependencies_parsed_at":"2022-07-21T22:17:59.377Z","dependency_job_id":null,"html_url":"https://github.com/sniper00/lua_timer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sniper00%2Flua_timer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sniper00%2Flua_timer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sniper00%2Flua_timer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sniper00%2Flua_timer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sniper00","download_url":"https://codeload.github.com/sniper00/lua_timer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248501960,"owners_count":21114681,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lua","luatimer","timer"],"created_at":"2024-11-14T22:07:41.717Z","updated_at":"2025-04-12T00:40:47.172Z","avatar_url":"https://github.com/sniper00.png","language":"Lua","readme":"# lua_timer\nPure lua implements timer ,support coroutine(with coroutine pool optimized)\n\n\n# Use\n\n**Call timer.update() in your framework's main loop/update**\n\n```lua\nlocal os = require ('os')\nlocal timer = require ('timer')\n\nlocal function co3()\n    print(\"coroutine3 start\",os.clock())\n    timer.sleep(5.5)\n    print(\"coroutine3 5.5 second later\",os.clock())\n    print(\"coroutine3 end\")\nend\n\n--coroutine style timer\ntimer.async(function()\n    print(\"coroutine1 start\",os.time())\n    timer.sleep(2)\n    print(\"coroutine1 2 second later\",os.time())\n    timer.async(co3)\n    print(\"coroutine1 end\")\nend)\n\ntimer.async(function()\n    print(\"coroutine2 start\",os.time())\n    timer.sleep(1)\n    print(\"coroutine2 1 second later\",os.time())\n    timer.sleep(1)\n    print(\"coroutine2 1 second later \",os.time())\n    timer.sleep(1)\n    print(\"coroutine2 1 second later \",os.time())\n    timer.sleep(1)\n    print(\"coroutine2 1 second later \",os.time() )\n    print(\"coroutine2 end\")\nend)\n\n--callback style timer\nlocal stime = os.time()\ntimer.timeout(1.5,function()\n    print(\"timer expired\", os.time() - stime)\nend)\n\n--remove a timer\nlocal ctx = timer.timeout(5,function()\n    error(\"this timer shoud not expired\")\nend)\ntimer.remove(ctx)\n\nprint(\"main thread noblock\")\n\nwhile true do\n    timer.update()\nend\n\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsniper00%2Flua_timer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsniper00%2Flua_timer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsniper00%2Flua_timer/lists"}