| 750 | } |
| 751 | |
| 752 | int 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 | |
| 770 | int Plugin::lua_cmd_wrapper(lua_State *state) |
| 771 | { |
nothing calls this directly
no test coverage detected