Use function class

This commit is contained in:
Federico Cecchetto
2021-06-19 22:17:41 +02:00
parent 7ac6443b2c
commit 97371d8f44
7 changed files with 105 additions and 38 deletions

View File

@ -2,6 +2,7 @@
#include "script_value.hpp"
#include "entity.hpp"
#include "array.hpp"
#include "function.hpp"
namespace scripting
{
@ -261,11 +262,17 @@ namespace scripting
**************************************************************/
template <>
bool script_value::is<std::function<void()>>() const
bool script_value::is<function>() const
{
return this->get_raw().type == game::SCRIPT_FUNCTION;
}
template <>
function script_value::get() const
{
return function(this->get_raw().u.codePosValue);
}
/***************************************************************
* Vector
**************************************************************/