]> git.lizzy.rs Git - lua_async_mt.git/commitdiff
Extend Documentation
authorElias Fleckenstein <eliasfleckenstein@web.de>
Fri, 6 Aug 2021 19:51:11 +0000 (21:51 +0200)
committerElias Fleckenstein <eliasfleckenstein@web.de>
Fri, 6 Aug 2021 19:51:11 +0000 (21:51 +0200)
README.md

index 91de317f57d982f3eee47f96e323e1416b1df5c6..90c576ec26567a5286dbeda28d3ef3d355bf65ab 100644 (file)
--- a/README.md
+++ b/README.md
@@ -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()`.