add utf8.encode(...)
This commit is contained in:
@@ -177,6 +177,11 @@ namespace lua {
|
||||
return 1;
|
||||
}
|
||||
|
||||
inline int pushlstring(lua::State* L, const void* chars, size_t size) {
|
||||
lua_pushlstring(L, reinterpret_cast<const char*>(chars), size);
|
||||
return 1;
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
inline int pushfstring(lua_State* L, const char* fmt, Args... args) {
|
||||
lua_pushfstring(L, fmt, args...);
|
||||
@@ -456,7 +461,16 @@ namespace lua {
|
||||
if (!isstring(L, idx)) {
|
||||
throw luaerror("string expected at " + std::to_string(idx));
|
||||
}
|
||||
return tostring(L, idx);
|
||||
return lua_tostring(L, idx);
|
||||
}
|
||||
|
||||
inline std::string_view require_lstring(lua::State* L, int idx) {
|
||||
if (!isstring(L, idx)) {
|
||||
throw luaerror("string expected at " + std::to_string(idx));
|
||||
}
|
||||
size_t len;
|
||||
const char* chars = lua_tolstring(L, idx, &len);
|
||||
return std::string_view(chars, len);
|
||||
}
|
||||
|
||||
std::wstring require_wstring(lua::State*, int idx);
|
||||
|
||||
Reference in New Issue
Block a user