add Bytearray support to lua::tovalue

This commit is contained in:
MihailRis 2025-01-18 03:46:42 +03:00
parent d2bbd82dbe
commit eaff5643a3

View File

@ -133,6 +133,13 @@ dv::value lua::tovalue(State* L, int idx) {
return map;
}
}
case LUA_TUSERDATA: {
if (auto bytes = touserdata<LuaBytearray>(L, idx)) {
const auto& data = bytes->data();
return std::make_shared<dv::objects::Bytes>(data.data(), data.size());
}
[[fallthrough]];
}
default:
throw std::runtime_error(
"lua type " + std::string(lua_typename(L, type)) +