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

Method lua_set_enabled

library/PluginManager.cpp:752–768  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

750}
751
752int Plugin::lua_set_enabled(lua_State *state)
753{
754 lua_settop(state, 1);
755 bool val = lua_toboolean(state, 1);
756
757 auto obj = (Plugin*)lua_touserdata(state, lua_upvalueindex(1));
758 RefAutoinc lock(obj->access);
759
760 color_ostream *out = Lua::GetOutput(state);
761
762 if (obj->state == PS_LOADED && obj->plugin_enable)
763 lua_pushboolean(state, obj->set_enabled(*out, val) == CR_OK);
764 else
765 luaL_error(state, "plugin %s unloaded, cannot enable or disable", obj->name.c_str());
766
767 return 1;
768}
769
770int Plugin::lua_cmd_wrapper(lua_State *state)
771{

Callers

nothing calls this directly

Calls 7

lua_settopFunction · 0.85
lua_tobooleanFunction · 0.85
lua_touserdataFunction · 0.85
lua_pushbooleanFunction · 0.85
luaL_errorFunction · 0.85
set_enabledMethod · 0.80
c_strMethod · 0.80

Tested by

no test coverage detected