+/* Wrapper for hwmode list */
+static int iwinfo_L_hwmodelist(lua_State *L, int (*func)(const char*, int *))
+{
+ const char *ifname = luaL_checkstring(L, 1);
+ int hwmodes = 0;
+
+ if( !(*func)(ifname, &hwmodes) )
+ {
+ lua_newtable(L);
+
+ lua_pushboolean(L, hwmodes & IWINFO_80211_A);
+ lua_setfield(L, -2, "a");
+
+ lua_pushboolean(L, hwmodes & IWINFO_80211_B);
+ lua_setfield(L, -2, "b");
+
+ lua_pushboolean(L, hwmodes & IWINFO_80211_G);
+ lua_setfield(L, -2, "g");
+
+ lua_pushboolean(L, hwmodes & IWINFO_80211_N);
+ lua_setfield(L, -2, "n");
+
+ return 1;
+ }
+
+ return 0;
+}
+