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

@ -0,0 +1,34 @@
#pragma once
#include "entity.hpp"
#include "script_value.hpp"
namespace scripting
{
class function
{
public:
function(const char*);
script_value get_raw() const;
const char* get_pos() const;
script_value call(entity self, std::vector<script_value> arguments) const;
script_value operator()(entity self, std::vector<script_value> arguments) const
{
return this->call(self, arguments);
}
script_value operator()(std::vector<script_value> arguments) const
{
return this->call(*game::levelEntityId, arguments);
}
script_value operator()() const
{
return this->call(*game::levelEntityId, {});
}
private:
const char* pos_;
};
}