+namespace {
+
+int call_num_channels(lua_State *L)
+{
+ lua_getglobal(L, "num_channels");
+
+ if (lua_pcall(L, 0, 1, 0) != 0) {
+ fprintf(stderr, "error running function `num_channels': %s\n", lua_tostring(L, -1));
+ exit(1);
+ }
+
+ int num_channels = luaL_checknumber(L, 1);
+ lua_pop(L, 1);
+ assert(lua_gettop(L) == 0);
+ return num_channels;
+}
+
+} // namespace
+