antirez/redis — pull request #1615 by jbochi (2014-03-18 11:47:25+00:00)
Title: Get script error handler only when needed

I believe this change improves scripting.c evalGenericCommand readability.

Instead of pushing the error handler before the function lookup (that needs to clean the stack if it fails), we can get the error handler just before the pcall, using lua_insert to move the error handler function to the proper position in the stack.

Besides avoiding the lua_pop when lookup fails, I believe it's easier to understand why the error handler is now being pushed into the stack, since it is closer to pcall function call and it also explains the -2 pcall argument naturally.