{
e = (struct iwinfo_txpwrlist_entry *) &rv[i];
- lua_pushinteger(L, x);
lua_newtable(L);
lua_pushnumber(L, e->mw);
lua_pushnumber(L, e->dbm);
lua_setfield(L, -2, "dbm");
- lua_settable(L, -3);
+ lua_rawseti(L, -2, x);
}
}
LUA_WRAP_STRING(wl,ssid)
LUA_WRAP_STRING(wl,bssid)
LUA_WRAP_STRING(wl,enctype)
-LUA_WRAP_ASSOCLIST(wl)
-LUA_WRAP_TXPWRLIST(wl)
+LUA_WRAP_LIST(wl,assoclist)
+LUA_WRAP_LIST(wl,txpwrlist)
/* Madwifi */
LUA_WRAP_INT(madwifi,channel)
LUA_WRAP_STRING(madwifi,ssid)
LUA_WRAP_STRING(madwifi,bssid)
LUA_WRAP_STRING(madwifi,enctype)
-LUA_WRAP_ASSOCLIST(madwifi)
-LUA_WRAP_TXPWRLIST(madwifi)
+LUA_WRAP_LIST(madwifi,assoclist)
+LUA_WRAP_LIST(madwifi,txpwrlist)
/* Wext */
LUA_WRAP_INT(wext,channel)
LUA_WRAP_STRING(wext,ssid)
LUA_WRAP_STRING(wext,bssid)
LUA_WRAP_STRING(wext,enctype)
-LUA_WRAP_ASSOCLIST(wext)
-LUA_WRAP_TXPWRLIST(wext)
+LUA_WRAP_LIST(wext,assoclist)
+LUA_WRAP_LIST(wext,txpwrlist)
/* Broadcom table */
static const luaL_reg R_wl[] = {
return 1; \
}
-#define LUA_WRAP_ASSOCLIST(type) \
- static int iwinfo_L_##type##_assoclist(lua_State *L)\
- { \
- return iwinfo_L_assoclist(L, \
- type##_get_assoclist); \
- }
-
-#define LUA_WRAP_TXPWRLIST(type) \
- static int iwinfo_L_##type##_txpwrlist(lua_State *L)\
+#define LUA_WRAP_LIST(type,op) \
+ static int iwinfo_L_##type##_##op(lua_State *L) \
{ \
- return iwinfo_L_txpwrlist(L, \
- type##_get_txpwrlist); \
+ return iwinfo_L_##op(L, type##_get_##op); \
}
#endif