From 4a758806d4f67f766c02190ef78b1ec626ce3d6e Mon Sep 17 00:00:00 2001 From: userMacieG Date: Mon, 20 Jul 2020 16:27:30 +0200 Subject: [PATCH] Update README.md (#4) --- README.md | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 7e1c2493..fb88196e 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,26 @@ -# fxserver-async +# async Async utilities for FXServer -[INSTALLATION] - +## Installation Set it as a dependency in you __resource.lua - ``` server_script '@async/async.lua' ``` -[USAGE] - +## Usage ``` local tasks = {} -for i=1, 100, 1 do - +for i = 1, 100, 1 do local task = function(cb) - SetTimeout(1000, function() - local result = math.random(1, 50000) cb(result) - end) - end table.insert(tasks, task) - end Async.parallel(tasks, function(results) @@ -43,5 +34,4 @@ end) Async.series(tasks, function(results) print(json.encode(results)) end) - -``` \ No newline at end of file +```