Lots of work on several unrelated things.

This commit is contained in:
2025-03-28 23:31:44 -04:00
parent 3741470b20
commit b26d56048f
30 changed files with 444 additions and 612 deletions

View File

@@ -77,7 +77,7 @@ public:
/////////////////////////////////////////////////////////////////
UENUM(BlueprintType)
enum class ELxLuaValueType : uint8 {
enum class ElxLuaValueType : uint8 {
None,
String,
Name,
@@ -105,7 +105,7 @@ private:
// For each chunk, the type of the chunk.
//
TArray<ELxLuaValueType> Types;
TArray<ElxLuaValueType> Types;
// For each chunk, a pointer to the serialized data.
//
@@ -120,16 +120,21 @@ private:
//
void Empty();
// Compare two types. If they aren't equal, log an error and return false.
//
static bool CheckType(ElxLuaValueType Type, ElxLuaValueType Desired);
public:
UlxLuaValues() { Cursor = 0; }
// Copies the data, and then preprocesses it to make sure
// it's all valid. If it's not valid, returns false.
//
bool Initialize(std::string_view data);
// Compare two types. If they aren't equal, log an error and return false.
//
static bool CheckType(ELxLuaValueType Type, ELxLuaValueType Desired);
UFUNCTION(BlueprintPure, Category = "Luprex|Lua Value Array")
FString DebugString() const;
public:
UFUNCTION(BlueprintPure, Category = "Luprex|Lua Value Array")
int Length() const { return Types.Num(); }
@@ -139,16 +144,17 @@ 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;
ElxLuaValueType GetType(int n) const;
UFUNCTION(BlueprintPure, Category = "Luprex|Lua Value Array")
bool IsType(int n, ELxLuaValueType Type) const { return GetType(n) == Type; }
bool IsType(int n, ElxLuaValueType Type) const { return GetType(n) == Type; }
UFUNCTION(BlueprintPure, Category = "Luprex|Lua Value Array")
FString GetString(int n) const;
@@ -177,10 +183,10 @@ private:
public:
UFUNCTION(BlueprintPure, Category = "Luprex|Lua Value Array")
ELxLuaValueType NextType() const { return GetType(Cursor); }
ElxLuaValueType NextType() const { return GetType(Cursor); }
UFUNCTION(BlueprintPure, Category = "Luprex|Lua Value Array")
bool IsNextType(ELxLuaValueType Type) const { return IsType(Cursor, Type); }
bool IsNextType(ElxLuaValueType Type) const { return IsType(Cursor, Type); }
UFUNCTION(BlueprintCallable, Category = "Luprex|Lua Value Array")
FString ReadString() { return GetString(Cursor++); }