.
This commit is contained in:
@@ -10,9 +10,10 @@ using FunctionId = uint32_t;
|
||||
|
||||
enum class Type : uint8_t
|
||||
{
|
||||
Nil = 0, Integer, Float, String, Array, Table, Function, NativePointer,
|
||||
Nil = 0, Integer, Float, String, Array, Table, Function, NativePointer, COUNT
|
||||
};
|
||||
|
||||
std::string type_name(Type type);
|
||||
|
||||
class Value {
|
||||
struct Function { FunctionId f_id; };
|
||||
@@ -26,6 +27,8 @@ public:
|
||||
static Value CreateString(std::string const& str) { return Value(str); }
|
||||
static Value CreateFunctionId(FunctionId f_id) { return Value(Function { f_id }); }
|
||||
|
||||
static Value CreateIntegerFromBool(bool b) { return CreateInteger(b ? 1 : 0); }
|
||||
|
||||
[[nodiscard]] Type type() const;
|
||||
|
||||
[[nodiscard]] int32_t as_integer() const { return std::get<int32_t>(value_); }
|
||||
|
||||
Reference in New Issue
Block a user