From 2615778348a16ac83b7afd9e86f08feda98da1df Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Fri, 6 Aug 2021 22:54:20 +0200 Subject: [PATCH] Port to Lua 5.3.3 --- README.md | 2 +- async_await.lua | 2 ++ immediates.lua | 1 + intervals.lua | 1 + promises.lua | 1 + timeouts.lua | 1 + 6 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index abaa7f2..b592877 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # lua_async -This project aims to provide an API similar to the Node.js Event loop - for Lua, fully written in Lua itself. It works with Lua 5.1, but will be ported to work with 5.3.3 in the future. +This project aims to provide an API similar to the Node.js Event loop - for Lua, fully written in Lua itself. It is tested with Lua 5.1 and Lua 5.3.3, but should probably work with any Lua 5.x. Note that the goal is not to clone the Node Event loop exactly. This is already fully usable, but some features are missing (Events, EventTargets, some Promise methods) and will be implemented in the near future. It also provides a few useful extra methods as well as basic scheduling. diff --git a/async_await.lua b/async_await.lua index 6965688..280982d 100644 --- a/async_await.lua +++ b/async_await.lua @@ -1,3 +1,5 @@ +local unpack = unpack or table.unpack + function async(func) return function(...) local promise = Promise() diff --git a/immediates.lua b/immediates.lua index 8913ddc..3e378fd 100644 --- a/immediates.lua +++ b/immediates.lua @@ -1,3 +1,4 @@ +local unpack = unpack or table.unpack lua_async.immediates = { pool = {}, executing = {}, diff --git a/intervals.lua b/intervals.lua index 2087fc1..a635f34 100644 --- a/intervals.lua +++ b/intervals.lua @@ -1,3 +1,4 @@ +local unpack = unpack or table.unpack lua_async.intervals = { pool = {}, executing = {}, diff --git a/promises.lua b/promises.lua index 97cd20e..0ab61a6 100644 --- a/promises.lua +++ b/promises.lua @@ -1,3 +1,4 @@ +local unpack = unpack or table.unpack local PromisePrototype = {} function PromisePrototype:__run_handler(func, ...) diff --git a/timeouts.lua b/timeouts.lua index 864889e..7b7e71a 100644 --- a/timeouts.lua +++ b/timeouts.lua @@ -1,3 +1,4 @@ +local unpack = unpack or table.unpack lua_async.timeouts = { pool = {}, executing = {}, -- 2.44.0