normally, I would just use
lua_pushstring(lua_State* L, const char* s);
however, the string I want to push might have a null character in it. How do I make that work?
normally, I would just use
lua_pushstring(lua_State* L, const char* s);
however, the string I want to push might have a null character in it. How do I make that work?
Use lua_pushlstring
.
void lua_pushlstring (lua_State *L, const char *s, size_t len);
Pushes the string pointed to by s with size len onto the stack. Lua makes (or reuses) an internal copy of the given string, so the memory at s can be freed or reused immediately after the function returns. The string can contain embedded zeros.