| 586 | } |
| 587 | |
| 588 | void ExtensionStateBase::LuaLoadPreinitBootstrap(ExtensionModConfig const& config, Module const& mod) |
| 589 | { |
| 590 | auto bootstrapFileName = "BootstrapModule.lua"; |
| 591 | auto const& sym = GetStaticSymbols(); |
| 592 | |
| 593 | auto path = ResolveModScriptPath(mod, bootstrapFileName); |
| 594 | if (!sym.FileExists(path)) { |
| 595 | return; |
| 596 | } |
| 597 | |
| 598 | LuaVirtualPin lua(*this); |
| 599 | auto L = lua->GetState(); |
| 600 | lua::push(L, mod.Info.ModuleUUID); |
| 601 | lua_setglobal(L, "ModuleUUID"); |
| 602 | |
| 603 | OsiMsg("Loading preinit bootstrap script: " << path); |
| 604 | PerfTimer timer; |
| 605 | lua->LoadBootstrap(bootstrapFileName, config.ModTable); |
| 606 | auto took = timer.time(); |
| 607 | if (PERF_SHOULD_REPORT(Load, took)) { |
| 608 | PERF_REPORT(Load, took, "Loading %s for mod %s took %lld ms", bootstrapFileName, mod.Info.Name.c_str(), took / 1000); |
| 609 | } |
| 610 | |
| 611 | lua::push(L, nullptr); |
| 612 | lua_setglobal(L, "ModuleUUID"); |
| 613 | } |
| 614 | |
| 615 | ExtensionStateBase* GetCurrentExtensionState() |
| 616 | { |
nothing calls this directly
no test coverage detected