AER-2678 - use as_nil to represent nil Lua stack values.
AER-2678 - map as_nil to NULL in mod_lua_stream_write(), so the server knows when a query result stream terminates.
Also, fix a compiler warning.
Mac needs to compile with -DLUA_DEBUG_HOOK