mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-24 17:10:03 +00:00
Improve debug message
This commit is contained in:
parent
5d6c2e8d42
commit
74ca305600
1 changed files with 4 additions and 6 deletions
|
@ -1666,16 +1666,14 @@ if _G.__JECS_DEBUG then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if world_has_one_inline(world, entity, id) then
|
if world_has_one_inline(world, entity, id) then
|
||||||
if invoked_hook then
|
if invoked_hook then
|
||||||
local file, line = debug.info(2, "sl")
|
local file, line = debug.info(2, "sl")
|
||||||
local hook_fn = `{file}::{line}`
|
local hook_fn = `{file}::{line}`
|
||||||
throw(
|
local why = `cannot call world:set inside {hook_fn} because it adds the component {get_name(world, id)}`
|
||||||
([[cannot call world:set within the
|
why ..= `\n[jecs note]: consider handling this logic inside of a system`
|
||||||
This world:set function invokes a structural change because %s doesn't exist on the entity.\n
|
throw(why)
|
||||||
call world:add when the hook %s is in process]]):format(get_name(world, id), hook_fn))
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue