mirror of
https://github.com/minetest/minetest.git
synced 2024-10-02 07:53:09 +02:00
Apply suggestions from code review
Co-authored-by: sfan5 <sfan5@live.de>
This commit is contained in:
parent
89079a6619
commit
e00f1d0763
@ -6126,9 +6126,11 @@ Environment access
|
||||
* `minetest.get_objects_inside_radius(center, radius)`
|
||||
* returns a list of ObjectRefs
|
||||
* `radius`: using a Euclidean metric
|
||||
* **Warning**: If you modify objects (f.e. punch them),
|
||||
this may cause later objects in the list (f.e. children) to become invalid.
|
||||
Use `minetest.objects_inside_radius` instead to iterate only valid objects
|
||||
* **Warning**: Any kind of interaction with the environment or other APIs
|
||||
can cause later objects in the list to become invalid while you're iterating it.
|
||||
(e.g. punching an entity removes its children)
|
||||
It is recommend to use `minetest.objects_inside_radius` instead, which
|
||||
transparently takes care of this possibility.
|
||||
* `minetest.objects_inside_radius(center, radius)`
|
||||
* returns an iterator of valid objects
|
||||
* example: `for obj in minetest.objects_inside_radius(center, radius) do obj:punch(...) end`
|
||||
|
@ -71,7 +71,7 @@ local function test_entity_lifecycle(_, pos)
|
||||
|
||||
-- with binary in staticdata
|
||||
local obj = core.add_entity(pos, "unittests:callbacks", "abc\000def")
|
||||
assert(obj:is_valid())
|
||||
assert(obj and obj:is_valid())
|
||||
check_log({"on_activate(7)"})
|
||||
|
||||
obj:set_hp(0)
|
||||
|
Loading…
Reference in New Issue
Block a user