lua_pop does a negation operation on the second argument passed in. If you use std::size_t or auto, t will generate warnings everywhere an unsigned type is unused. std::ptrdiff_t is intentional.