Added support for creating a string outline of a bound script for debugging purposes
Some checks reported errors
continuous-integration/drone/push Build was killed

This commit is contained in:
2019-09-02 20:48:52 +02:00
parent e0941a9db8
commit d21cfeaac8
11 changed files with 370 additions and 0 deletions

View File

@@ -26,6 +26,7 @@ namespace Porygon{
All,
};
class ScriptType{
TypeClass _class;
public:
@@ -84,6 +85,26 @@ namespace Porygon{
return CastResult::InvalidCast;
return CastResult::InvalidCast;
}
static std::string ToString(TypeClass c){
switch (c){
case TypeClass::Error: return "error";
case TypeClass::Nil: return "nil";
case TypeClass::Number: return "number";
case TypeClass::Bool: return "bool";
case TypeClass::String: return "string";
case TypeClass::Function: return "function";
case TypeClass::UserData: return "userdata";
case TypeClass::Table: return "table";
case TypeClass::All: return "all";
}
throw exception();
}
[[nodiscard]] virtual std::string ToString() const{
return ToString(this->_class);
}
};
class NumericScriptType : public ScriptType{