We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TS.async and TS.await functions return only one argument meaning that a Tuple promise only has first argument returned instead of every
example Code only will run in a async function
async function Test() { return $tuple(1, 2); } // returns only 1 instead of 1, 2 print(await Test());
fixed portion of the RuntimeLib starts at line 136 I havent tested rejection
RuntimeLib
rejection
function TS.async(callback) return function(...) local n = select("#", ...) local args = { ... } return Promise.new(function(resolve, reject) coroutine.wrap(function() local resArray = {pcall(callback, unpack(args, 1, n))} local ok = resArray[1] if ok then resolve(unpack(resArray, 2)) else reject(unpack(resArray, 2)) end end)() end) end end function TS.await(promise) if not Promise.is(promise) then return promise end local array = {promise:awaitStatus()} local status = array[1] if status == Promise.Status.Resolved then return unpack(array, 2) elseif status == Promise.Status.Rejected then error(array[2], 2) else error("The awaited Promise was cancelled", 2) end end
The text was updated successfully, but these errors were encountered:
No branches or pull requests
TS.async and TS.await functions return only one argument meaning that a Tuple promise only has first argument returned instead of every
example
Code only will run in a async function
fixed portion of the
RuntimeLib
starts at line 136I havent tested
rejection
The text was updated successfully, but these errors were encountered: