From 74ca305600211aa7c241231236744c745482e5e7 Mon Sep 17 00:00:00 2001 From: Ukendio Date: Sat, 21 Sep 2024 21:28:06 +0200 Subject: [PATCH] Improve debug message --- src/init.luau | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/init.luau b/src/init.luau index aaa8161..91f76c3 100644 --- a/src/init.luau +++ b/src/init.luau @@ -1666,16 +1666,14 @@ if _G.__JECS_DEBUG then return end - - if world_has_one_inline(world, entity, id) then if invoked_hook then local file, line = debug.info(2, "sl") local hook_fn = `{file}::{line}` - throw( - ([[cannot call world:set within the - This world:set function invokes a structural change because %s doesn't exist on the entity.\n - call world:add when the hook %s is in process]]):format(get_name(world, id), hook_fn)) + local why = `cannot call world:set inside {hook_fn} because it adds the component {get_name(world, id)}` + why ..= `\n[jecs note]: consider handling this logic inside of a system` + throw(why) + return end end