Handle __pairs when marshalling Lua-to-PHP

Tables that have a custom __pairs method are not being PHPized properly,
it's effectively using "rawpairs". This means that, for example, passing
a table from mw.loadData to PHP doesn't work right.

The fix is to use the __pairs function if it exists in the metatable. We
could, in fact, just use 'pairs' itself in all cases, but using lua_next
for the common case where there is no __pairs avoids the overhead of
timers and pcalls needed when calling user-provided Lua code.

Change-Id: I8cd51efc624554db6d375562aaa9421559603fae