MCPcopy
hub / github.com/silverbulletmd/silverbullet / loadLuaScripts

Method loadLuaScripts

client/client_system.ts:191–224  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

189 }
190
191 async loadLuaScripts() {
192 if (this.client.bootConfig.disableSpaceLua) {
193 console.info("Space Lua scripts are disabled, skipping loading scripts");
194 return;
195 }
196 if (!(await this.objectIndex.isIndexAvailable())) {
197 console.info(
198 "Not loading space scripts, since no index is available yet",
199 );
200 return;
201 }
202 this.client.config.clear();
203 try {
204 await this.spaceLuaEnv.reload();
205 } catch (e: any) {
206 console.error("Error loading Lua script:", e.message);
207 }
208
209 // Reset the space script commands
210 this.scriptCommands.clear();
211 for (const [name, command] of Object.entries(
212 this.client.config.get<Record<string, Command>>("commands", {}),
213 )) {
214 this.scriptCommands.set(name, command);
215 }
216
217 // Make scripted (slash) commands available
218 this.commandHook.throttledBuildAllCommandsAndEmit();
219 this.slashCommandHook.throttledBuildAllCommands();
220 this.mqHook.throttledReloadQueues();
221
222 this.scriptsLoaded = true;
223 this.client.maybeDispatchWidgetsReady();
224 }
225
226 async loadPlugFromPath(path: string, lastModified: number) {
227 await this.system.loadPlug(

Callers 3

reloadStateMethod · 0.95
initMethod · 0.80
systemSyscallsFunction · 0.80

Calls 6

isIndexAvailableMethod · 0.80
reloadMethod · 0.80
clearMethod · 0.65
getMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected