+std::string Theme::get_channel_name(unsigned channel)
+{
+ unique_lock<mutex> lock(m);
+ lua_getglobal(L, "channel_name");
+ lua_pushnumber(L, channel);
+ if (lua_pcall(L, 1, 1, 0) != 0) {
+ fprintf(stderr, "error running function `channel_nam': %s\n", lua_tostring(L, -1));
+ exit(1);
+ }
+
+ std::string ret = lua_tostring(L, -1);
+ lua_pop(L, 1);
+ assert(lua_gettop(L) == 0);
+ return ret;
+}
+
+bool Theme::get_supports_set_wb(unsigned channel)
+{
+ unique_lock<mutex> lock(m);
+ lua_getglobal(L, "supports_set_wb");
+ lua_pushnumber(L, channel);
+ if (lua_pcall(L, 1, 1, 0) != 0) {
+ fprintf(stderr, "error running function `supports_set_wb': %s\n", lua_tostring(L, -1));
+ exit(1);
+ }
+
+ bool ret = checkbool(L, -1);
+ lua_pop(L, 1);
+ assert(lua_gettop(L) == 0);
+ return ret;
+}
+
+void Theme::set_wb(unsigned channel, double r, double g, double b)
+{
+ unique_lock<mutex> lock(m);
+ lua_getglobal(L, "set_wb");
+ lua_pushnumber(L, channel);
+ lua_pushnumber(L, r);
+ lua_pushnumber(L, g);
+ lua_pushnumber(L, b);
+ if (lua_pcall(L, 4, 0, 0) != 0) {
+ fprintf(stderr, "error running function `set_wb': %s\n", lua_tostring(L, -1));
+ exit(1);
+ }
+
+ assert(lua_gettop(L) == 0);
+}
+