Compare commits

...

5 Commits

Author SHA1 Message Date
Elias Fleckenstein 916c6f084a
Fix paths 2022-05-18 18:01:31 +02:00
Elias Fleckenstein ee847434f5
Update to latest lua_async commit 2021-12-14 18:13:28 +01:00
Elias Fleckenstein 1d6a6826a0 Add new lua_async commits 2021-08-06 23:19:50 +02:00
Elias Fleckenstein 0352744756 Add new lua_async commits 2021-08-06 21:51:28 +02:00
Elias Fleckenstein af43d8d5ac Extend Documentation 2021-08-06 21:51:11 +02:00
3 changed files with 5 additions and 4 deletions

View File

@ -8,4 +8,5 @@ See https://github.com/EliasFleckenstein03/lua_async for API documentation.
### `lua_async.mt_validate_objs([obj1, obj2, ...])`
Must be called from an async function.
Validates all Minetest ObjectRefs passed as arguments, meaning it checks if they have been removed (in the case of luaentities) or left the game (in the case of players). If one of the refs is not valid, the current thread dies - essentially meaning _this function never returns_ if one of the ObjectRefs is not valid. An error is raised if arguments are given to this function that are not ObjectRefs at all.
Validates all Minetest ObjectRefs passed as arguments, meaning it checks if they have been removed (in the case of luaentities) or left the game (in the case of players). If one of the refs is not valid, the current thread dies - essentially meaning _this function never returns_ if one of the ObjectRefs is not valid. An error is raised if an arguments are given to this function that is not ObjectRefs at all.
Since ObjectRefs may turn into dangling ones after a `yield` (which includes `await`, `sleep` or other functions that may pause the current thread) it is recommended you revalidate your ObjectRef every time after calling a function that may potentially pause to later resume in a different globalstep either this way (if you want to just stop execution of the current thread in case your ObjectRef is invalid, which is often the case) or by validating them manually using `obj:is_player() or obj:get_luaentity()`.

View File

@ -1,6 +1,6 @@
local path = minetest.get_modpath(minetest.get_current_modname()) .. "/src/"
local path = minetest.get_modpath(minetest.get_current_modname()) .. "/src"
dofile(path .. "init.lua")(path)
dofile(path .. "/init.lua")(path, true)
minetest.register_globalstep(function(dtime)
lua_async.step(dtime)

2
src

@ -1 +1 @@
Subproject commit 457e91a5eeba4a211fc0abdaf0e8fb200ec0dfb9
Subproject commit 6fcf6209e05410d5ac077ecce6c940197d430c8a