Slightly optimize returning strings to lua from ffi functions
Eliminate a pointless set that only ever had zero or one entries
Extract some bits that don't need to be templated from templates

Cuts compile time by about 10% and shrinks the final binary a little.