[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Correct way to push an empty string?
- From: Tim Hill <drtimhill@...>
- Date: Sat, 22 Aug 2015 15:18:56 -0700
In lua_pushlstring():
const char *lua_pushlstring (lua_State *L, const char *s, size_t len);
The docs don’t appear to specify what is allowable input when “len” is zero (that is, pushing an empty string). Can “s” be NULL in this case? We have a number of libraries that tend to return empty data as NULL pointer plus zero length. To be safe I coerce “s” to point to an arbitrary (valid) memory location, but it would be nice to just pass through the NULL in this case and save the extra logic.
—Tim