Lua Console Overhaul in progress

This commit is contained in:
2025-12-09 02:42:13 -05:00
parent a242244f9c
commit 2d1def8dc6
10 changed files with 105 additions and 63 deletions

View File

@@ -202,6 +202,37 @@ FString UlxLuaCallLibrary::AllFunctionsWithPrefix(const TCHAR *Prefix)
//
/////////////////////////////////////////////////////////////////
void UlxLuaCallLibrary::ValidateLua(
ElxLuaSyntaxCheck &Result, FString &ErrorMessage, UObject *context, const FString &Code)
{
if (Code.StartsWith(TEXT("/")))
{
ErrorMessage = "SlashCommand";
Result = ElxLuaSyntaxCheck::SlashCommand;
return;
}
if (Code.TrimStart().IsEmpty())
{
ErrorMessage = "";
Result = ElxLuaSyntaxCheck::Whitespace;
return;
}
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
ErrorMessage = mode->LuaValidate(Code);
if (ErrorMessage.IsEmpty())
{
Result = ElxLuaSyntaxCheck::ValidLua;
}
else if (ErrorMessage.Contains(TEXT("<eof>")))
{
Result = ElxLuaSyntaxCheck::TruncatedLua;
}
else
{
Result = ElxLuaSyntaxCheck::InvalidLua;
}
}
void UlxLuaCallLibrary::LuaCallBegin(UObject *context, const FString &cname, const FString &fname)
{
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
@@ -211,7 +242,6 @@ void UlxLuaCallLibrary::LuaCallBegin(UObject *context, const FString &cname, con
sb.write_string(fname);
}
void UlxLuaCallLibrary::LuaCallInvoke(UObject *context, AActor *place)
{
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);