mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add Bytearray support to lua::tovalue
This commit is contained in:
parent
d2bbd82dbe
commit
eaff5643a3
1 changed files with 7 additions and 0 deletions
|
|
@ -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)) +
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue