fix: pack environment not passed to components

This commit is contained in:
MihailRis 2025-12-01 22:01:18 +03:00
parent c0d326061e
commit 69cf4c1c04
4 changed files with 19 additions and 4 deletions

View file

@ -708,12 +708,15 @@ void scripting::load_content_script(
}
void scripting::load_entity_component(
const std::string& name, const io::path& file, const std::string& fileName
const scriptenv& env,
const std::string& name,
const io::path& file,
const std::string& fileName
) {
auto L = lua::get_main_state();
std::string src = io::read_string(file);
logger.info() << "script (component) " << file.string();
lua::loadbuffer(L, 0, src, fileName);
lua::loadbuffer(L, *env, src, fileName);
lua::store_in(L, lua::CHUNKS_TABLE, name);
}