Got the whole look-at demo up and running.

This commit is contained in:
2025-04-07 19:29:47 -04:00
parent 865297331a
commit c060b87556
8 changed files with 166 additions and 149 deletions

View File

@@ -7,6 +7,36 @@
class UlxLuaValues;
/////////////////////////////////////////////////////////////////
//
// These are the types that can actually be packed into
// a serialized buffer.
//
/////////////////////////////////////////////////////////////////
UENUM(BlueprintType)
enum class ElxLuaValueType : uint8 {
None,
String,
Name,
Float,
Boolean,
Vector
};
/////////////////////////////////////////////////////////////////
//
// A general-purpose 'success or error' type.
//
/////////////////////////////////////////////////////////////////
UENUM(BlueprintType)
enum class ElxSuccessOrError : uint8 {
Success,
Error,
};
/////////////////////////////////////////////////////////////////
//
// This is a little parser that parses Lua function 'prototypes'.
@@ -177,24 +207,6 @@ public:
/////////////////////////////////////////////////////////////////
//
// These are the types that can actually be packed into
// a serialized buffer.
//
/////////////////////////////////////////////////////////////////
UENUM(BlueprintType)
enum class ElxLuaValueType : uint8 {
None,
String,
Name,
Float,
Boolean,
Vector
};
/////////////////////////////////////////////////////////////////
//
@@ -231,7 +243,7 @@ private:
// Compare two types. If they aren't equal, log an error and return false.
//
static bool CheckType(ElxLuaValueType Type, ElxLuaValueType Desired);
static ElxSuccessOrError CheckType(ElxLuaValueType Type, ElxLuaValueType Desired);
public:
UlxLuaValues() { Cursor = 0; }
@@ -253,68 +265,33 @@ public:
UFUNCTION(BlueprintCallable, Category = "Luprex|Lua Value Array")
void SetCursor(int n) { Cursor = n; }
private:
//
// Functions that get values from the array, random access.
//
UFUNCTION(BlueprintPure, Category = "Luprex|Lua Value Array")
ElxLuaValueType GetType(int n) const;
UFUNCTION(BlueprintPure, Category = "Luprex|Lua Value Array")
bool IsType(int n, ElxLuaValueType Type) const { return GetType(n) == Type; }
UFUNCTION(BlueprintPure, Category = "Luprex|Lua Value Array")
FString GetString(int n) const;
ElxLuaValueType NextType() const;
UFUNCTION(BlueprintPure, Category = "Luprex|Lua Value Array")
FName GetName(int n) const;
bool IsNextType(ElxLuaValueType Type) const { return NextType() == Type; }
UFUNCTION(BlueprintCallable, meta = (ExpandEnumAsExecs = "ReturnValue"), Category = "Luprex|Lua Value Array")
ElxLuaValueType SwitchNextType() const { return NextType(); }
UFUNCTION(BlueprintPure, Category = "Luprex|Lua Value Array")
double GetFloat(int n) const;
UFUNCTION(BlueprintPure, Category = "Luprex|Lua Value Array")
int GetInt(int n) const;
UFUNCTION(BlueprintPure, Category = "Luprex|Lua Value Array")
FVector GetVector(int n) const;
UFUNCTION(BlueprintPure, Category = "Luprex|Lua Value Array")
FVector2D GetVector2D(int n) const;
UFUNCTION(BlueprintPure, Category = "Luprex|Lua Value Array")
bool GetBoolean(int n) const;
//
// Functions that get values from the array using the cursor.
//
public:
UFUNCTION(BlueprintPure, Category = "Luprex|Lua Value Array")
ElxLuaValueType NextType() const { return GetType(Cursor); }
UFUNCTION(BlueprintPure, Category = "Luprex|Lua Value Array")
bool IsNextType(ElxLuaValueType Type) const { return IsType(Cursor, Type); }
UFUNCTION(BlueprintCallable, Category = "Luprex|Lua Value Array")
FString ReadString() { return GetString(Cursor++); }
UFUNCTION(BlueprintCallable, meta = (ExpandEnumAsExecs = "Status"), Category = "Luprex|Lua Value Array")
void ReadString(ElxSuccessOrError &Status, FString &Result);
UFUNCTION(BlueprintCallable, Category = "Luprex|Lua Value Array")
FName ReadName() { return GetName(Cursor++); }
UFUNCTION(BlueprintCallable, meta = (ExpandEnumAsExecs = "Status"), Category = "Luprex|Lua Value Array")
void ReadName(ElxSuccessOrError &Status, FName &Result);
UFUNCTION(BlueprintCallable, Category = "Luprex|Lua Value Array")
double ReadFloat() { return GetFloat(Cursor++); }
UFUNCTION(BlueprintCallable, meta = (ExpandEnumAsExecs = "Status"), Category = "Luprex|Lua Value Array")
void ReadFloat(ElxSuccessOrError &Status, double &Result);
UFUNCTION(BlueprintCallable, Category = "Luprex|Lua Value Array")
int ReadInt() { return GetInt(Cursor++); }
UFUNCTION(BlueprintCallable, meta = (ExpandEnumAsExecs = "Status"), Category = "Luprex|Lua Value Array")
void ReadInt(ElxSuccessOrError &Status, int &Result);
UFUNCTION(BlueprintCallable, Category = "Luprex|Lua Value Array")
FVector ReadVector() { return GetVector(Cursor++); }
UFUNCTION(BlueprintCallable, meta = (ExpandEnumAsExecs = "Status"), Category = "Luprex|Lua Value Array")
void ReadVector(ElxSuccessOrError &Status, FVector &Result);
UFUNCTION(BlueprintCallable, Category = "Luprex|Lua Value Array")
FVector2D ReadVector2D() { return GetVector2D(Cursor++); }
UFUNCTION(BlueprintCallable, meta = (ExpandEnumAsExecs = "Status"), Category = "Luprex|Lua Value Array")
void ReadVector2D(ElxSuccessOrError &Status, FVector2D &Result);
UFUNCTION(BlueprintCallable, Category = "Luprex|Lua Value Array")
bool ReadBoolean() { return GetBoolean(Cursor++); }
UFUNCTION(BlueprintCallable, meta = (ExpandEnumAsExecs = "Status"), Category = "Luprex|Lua Value Array")
void ReadBoolean(ElxSuccessOrError &Status, bool &Result);
};