mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
'dynamic' namespace refactor (step 2)
This commit is contained in:
parent
d33edd4cd9
commit
8e83a07094
10 changed files with 44 additions and 51 deletions
|
|
@ -311,18 +311,18 @@ std::unique_ptr<dynamic::Value> lua::LuaState::tovalue(int idx) {
|
|||
case LUA_TNONE:
|
||||
return std::make_unique<Value>(std::monostate());
|
||||
case LUA_TBOOLEAN:
|
||||
return Value::boolean(lua_toboolean(L, idx) == 1);
|
||||
return dynamic::value_of(lua_toboolean(L, idx) == 1);
|
||||
case LUA_TNUMBER: {
|
||||
auto number = lua_tonumber(L, idx);
|
||||
auto integer = lua_tointeger(L, idx);
|
||||
if (number == (lua_Number)integer) {
|
||||
return Value::of(integer);
|
||||
return dynamic::value_of(integer);
|
||||
} else {
|
||||
return Value::of(number);
|
||||
return dynamic::value_of(number);
|
||||
}
|
||||
}
|
||||
case LUA_TSTRING:
|
||||
return Value::of(lua_tostring(L, idx));
|
||||
return dynamic::value_of(lua_tostring(L, idx));
|
||||
case LUA_TTABLE: {
|
||||
int len = lua_objlen(L, idx);
|
||||
if (len) {
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ static int l_get_setting(lua_State* L) {
|
|||
static int l_set_setting(lua_State* L) {
|
||||
auto name = lua_tostring(L, 1);
|
||||
const auto value = scripting::state->tovalue(2);
|
||||
scripting::engine->getSettingsHandler().setValue(name, *value);
|
||||
scripting::engine->getSettingsHandler().setValue(name, value->value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue