Fix crash when calling zlib.deflate()()

It looks like zlib.deflate()() is intended to be equivalent to zlib.deflate()("", "finish"), but lua_tolstring was potentially accessing an invalid stack element, which could cause crashes. This fixes it by checking to ensure the stack element is valid before the access.