migrate from dynamic::Value to dv::value & total erase namespace 'dynamic'
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
#include "coders/toml.hpp"
|
||||
#include "data/dynamic.hpp"
|
||||
#include "api_lua.hpp"
|
||||
|
||||
using namespace scripting;
|
||||
@@ -7,8 +6,8 @@ using namespace scripting;
|
||||
static int l_toml_stringify(lua::State* L) {
|
||||
auto value = lua::tovalue(L, 1);
|
||||
|
||||
if (auto mapptr = std::get_if<dynamic::Map_sptr>(&value)) {
|
||||
auto string = toml::stringify(**mapptr);
|
||||
if (value.isObject()) {
|
||||
auto string = toml::stringify(value);
|
||||
return lua::pushstring(L, string);
|
||||
} else {
|
||||
throw std::runtime_error("table expected");
|
||||
@@ -18,8 +17,7 @@ static int l_toml_stringify(lua::State* L) {
|
||||
static int l_toml_parse(lua::State* L) {
|
||||
auto string = lua::require_string(L, 1);
|
||||
auto element = toml::parse("<string>", string);
|
||||
auto value = std::make_unique<dynamic::Value>(element);
|
||||
return lua::pushvalue(L, *value);
|
||||
return lua::pushvalue(L, element);
|
||||
}
|
||||
|
||||
const luaL_Reg tomllib[] = {
|
||||
|
||||
Reference in New Issue
Block a user