Information - ข้อมูลเบื้องต้น

  • เวอร์ชั่นปัจจุบัน 1.0.0

VSCode Extensions - ส่วนเสริมโปรแกรม

Installation - ติดตั้ง

Download ให้คุณไปที่ไฟล์ fxmanifest.lua ของโฟลเดอร์ Project ที่คุณต้องการใช้งาน ns_async และเพิ่ม
server_scripts {
  '@ns_async/async.lua'
}
หลังจากนั้นให้คุณไปที่ไฟล์ Source Code ของคุณและเริ่มต้นใช้งานทรัพยากร ns_async
local tasks = {}
local simulateCount = 100

for _ = 1, simulateCount do
    table.insert(tasks, function(cb)
        for _ = 1, math.random(50, 100) do
            if math.random(0, 30) > 25 then
                break
            end
        end

        cb()
    end)
end

Async.parallel(tasks, function(results)
    print(('Tasks completed %s tasks'):format(simulateCount))
end)