aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL/squirrel
diff options
context:
space:
mode:
Diffstat (limited to 'NorthstarDLL/squirrel')
-rw-r--r--NorthstarDLL/squirrel/squirrel.cpp12
-rw-r--r--NorthstarDLL/squirrel/squirrel.h2
-rw-r--r--NorthstarDLL/squirrel/squirrelclasstypes.h1
3 files changed, 15 insertions, 0 deletions
diff --git a/NorthstarDLL/squirrel/squirrel.cpp b/NorthstarDLL/squirrel/squirrel.cpp
index 5e968daa..8761fb13 100644
--- a/NorthstarDLL/squirrel/squirrel.cpp
+++ b/NorthstarDLL/squirrel/squirrel.cpp
@@ -88,6 +88,18 @@ eSQReturnType SQReturnTypeFromString(const char* pReturnType)
return eSQReturnType::Default; // previous default value
}
+ScriptContext ScriptContextFromString(std::string string)
+{
+ if (string == "UI")
+ return ScriptContext::UI;
+ if (string == "CLIENT")
+ return ScriptContext::CLIENT;
+ if (string == "SERVER")
+ return ScriptContext::SERVER;
+ else
+ return ScriptContext::INVALID;
+}
+
const char* SQTypeNameFromID(int type)
{
switch (type)
diff --git a/NorthstarDLL/squirrel/squirrel.h b/NorthstarDLL/squirrel/squirrel.h
index 3e3d08c9..51fa93b3 100644
--- a/NorthstarDLL/squirrel/squirrel.h
+++ b/NorthstarDLL/squirrel/squirrel.h
@@ -37,6 +37,8 @@ const char* GetContextName_Short(ScriptContext context);
eSQReturnType SQReturnTypeFromString(const char* pReturnType);
const char* SQTypeNameFromID(const int iTypeId);
+ScriptContext ScriptContextFromString(std::string string);
+
std::shared_ptr<ColoredLogger> getSquirrelLoggerByContext(ScriptContext context);
namespace NS::log
diff --git a/NorthstarDLL/squirrel/squirrelclasstypes.h b/NorthstarDLL/squirrel/squirrelclasstypes.h
index e26bc8d0..0672724c 100644
--- a/NorthstarDLL/squirrel/squirrelclasstypes.h
+++ b/NorthstarDLL/squirrel/squirrelclasstypes.h
@@ -73,6 +73,7 @@ struct SQFuncRegistration
enum class ScriptContext : int
{
+ INVALID = -1,
SERVER,
CLIENT,
UI,