MCPcopy Create free account
hub / github.com/DFHack/dfhack / index_lua

Method index_lua

library/PluginManager.cpp:688–724  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

686}
687
688void Plugin::index_lua(DFLibrary *lib)
689{
690 if (auto cmdlist = (CommandReg*)LookupPlugin(lib, "plugin_lua_commands"))
691 {
692 for (; cmdlist->name; ++cmdlist)
693 {
694 auto &cmd = lua_commands[cmdlist->name];
695 if (!cmd) cmd = new LuaCommand(this,cmdlist->name);
696 cmd->command = cmdlist->command;
697 }
698 }
699 if (auto funlist = (FunctionReg*)LookupPlugin(lib, "plugin_lua_functions"))
700 {
701 for (; funlist->name; ++funlist)
702 {
703 auto &cmd = lua_functions[funlist->name];
704 if (!cmd) cmd = new LuaFunction(this,funlist->name);
705 cmd->identity = funlist->identity;
706 }
707 }
708 if (auto evlist = (EventReg*)LookupPlugin(lib, "plugin_lua_events"))
709 {
710 for (; evlist->name; ++evlist)
711 {
712 auto &cmd = lua_events[evlist->name];
713 if (!cmd) cmd = new LuaEvent(this,evlist->name);
714 cmd->handler.identity = evlist->event->get_handler();
715 cmd->event = evlist->event;
716 if (cmd->active)
717 {
718 cmd->event->bind(DFHack::Core::getInstance().getLuaState(), cmd);
719 if (cmd->count > 0)
720 cmd->event->on_count_changed(cmd->count, 0);
721 }
722 }
723 }
724}
725
726void Plugin::reset_lua()
727{

Callers

nothing calls this directly

Calls 3

LookupPluginFunction · 0.85
on_count_changedMethod · 0.80
bindMethod · 0.45

Tested by

no test coverage detected