@@ -32,8 +32,13 @@ int ModuleHelper::Deinitialize(Lua::ILuaBase *LUA) {
3232 return 0 ;
3333}
3434
35- void ModuleHelper::AddSubModuleFactory (
36- std::function<std::shared_ptr<ModuleBase>()> &&factory) {
35+ const std::string& ModuleHelper::ModuleName () const {
36+ return m_module_name;
37+ }
38+
39+ ModuleHelper::ModuleHelper (const std::string& module_name) : m_module_name(module_name) {}
40+
41+ void ModuleHelper::AddSubModuleFactory (SubModuleFactory&& factory) {
3742 m_submodule_factories.emplace_back (std::move (factory));
3843}
3944
@@ -71,7 +76,7 @@ bool ModuleHelper::EnableThink(Lua::ILuaBase *LUA,
7176 }
7277
7378 LUA->PushString (" Think" );
74- LUA->PushString (" module." GMOD_MODULE_NAME " .Think" );
79+ LUA->PushFormattedString (" module.%s .Think" , ModuleName (). c_str () );
7580 PushMemberFunction (LUA, wrapper, function_reference);
7681
7782 // NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers)
@@ -118,7 +123,7 @@ bool ModuleHelper::DisableThink(Lua::ILuaBase *LUA) const {
118123 }
119124
120125 LUA->PushString (" Think" );
121- LUA->PushString (" module." GMOD_MODULE_NAME " .Think" );
126+ LUA->PushFormattedString (" module.%s .Think" , ModuleName (). c_str () );
122127
123128 if (LUA->PCall (2 , 0 , -4 ) != 0 ) {
124129 dynamic_cast <Lua::ILuaInterface *>(LUA)->ErrorNoHalt (" \n %s\n\n " ,
0 commit comments