mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-13 15:01:49 +00:00
fix serialization error for specific types
This commit is contained in:
parent
b307b5c93b
commit
2f729bd3cb
1 changed files with 11 additions and 5 deletions
|
|
@ -76,6 +76,10 @@ int lua::pushwstring(State* L, const std::wstring& str) {
|
||||||
return pushstring(L, util::wstr2str_utf8(str));
|
return pushstring(L, util::wstr2str_utf8(str));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::string to_ptr_string(State* L, int idx) {
|
||||||
|
return std::to_string(reinterpret_cast<ptrdiff_t>(lua_topointer(L, idx)));
|
||||||
|
}
|
||||||
|
|
||||||
dv::value lua::tovalue(State* L, int idx) {
|
dv::value lua::tovalue(State* L, int idx) {
|
||||||
using dv::value_type;
|
using dv::value_type;
|
||||||
auto type = lua::type(L, idx);
|
auto type = lua::type(L, idx);
|
||||||
|
|
@ -95,11 +99,13 @@ dv::value lua::tovalue(State* L, int idx) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case LUA_TFUNCTION:
|
case LUA_TFUNCTION:
|
||||||
return "<function " +
|
return "<function " + to_ptr_string(L, idx) + ">";
|
||||||
std::to_string(
|
case LUA_TTHREAD:
|
||||||
reinterpret_cast<ptrdiff_t>(lua_topointer(L, idx))
|
return "<thread " + to_ptr_string(L, idx) + ">";
|
||||||
) +
|
case LUA_TUSERDATA:
|
||||||
">";
|
return "<userdata " + to_ptr_string(L, idx) + ">";
|
||||||
|
case LUA_TLIGHTUSERDATA:
|
||||||
|
return "<lightuserdata " + to_ptr_string(L, idx) + ">";
|
||||||
case LUA_TSTRING:
|
case LUA_TSTRING:
|
||||||
return std::string(tostring(L, idx));
|
return std::string(tostring(L, idx));
|
||||||
case LUA_TTABLE: {
|
case LUA_TTABLE: {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue