port mgetKeys to Lua