|
Compilers nowadays won't call strlen for string literals: https://godbolt.org/z/s996MTFor literal strings, lua_pushstring is both simpler to use and faster.lua_pushstring(L, "cannot close standard file");Can be simpler, but it is not faster than:
/* avoid strlen call or inline */
lua_pushlstring(L, "cannot close standard file", sizeof("cannot close standard file") - 1);
Don't assume, test, measure, look at the compiler's output.
Andre Leiradella