Small change

This commit is contained in:
Federico Cecchetto 2021-06-26 00:42:00 +02:00
parent bdfd37de35
commit 44886c8f9f
4 changed files with 26 additions and 2 deletions

View File

@ -150,7 +150,7 @@ namespace io
array.push(file);
}
return array.get_raw();
return array;
});
gsc::function::add("copyfolder", [](const gsc::function_args& args)

View File

@ -168,7 +168,7 @@ namespace json
array[key] = args[i + 1];
}
return array.get_raw();
return array;
});
gsc::function::add("jsonparse", [](const gsc::function_args& args)

View File

@ -103,6 +103,24 @@ namespace scripting
this->value_ = variable;
}
script_value::script_value(const array& value)
{
game::VariableValue variable{};
variable.type = game::SCRIPT_OBJECT;
variable.u.pointerValue = value.get_entity_id();
this->value_ = variable;
}
script_value::script_value(const function& value)
{
game::VariableValue variable{};
variable.type = game::SCRIPT_OBJECT;
variable.u.codePosValue = value.get_pos();
this->value_ = variable;
}
/***************************************************************
* Integer
**************************************************************/

View File

@ -6,6 +6,8 @@
namespace scripting
{
class entity;
class array;
class function;
class script_value
{
@ -29,6 +31,10 @@ namespace scripting
script_value(const vector& value);
script_value(const array& value);
script_value(const function& value);
template <typename T>
bool is() const;