Add support for LuaToken to the LuaCall unreal pipeline
This commit is contained in:
@@ -30,6 +30,13 @@ void UlxLuaCallLibrary::LuaCallAddStringParameter(UObject *context, const FStrin
|
||||
sb.write_string(pstring);
|
||||
}
|
||||
|
||||
void UlxLuaCallLibrary::LuaCallAddNameParameter(UObject *context, const FName &pname) {
|
||||
AIntegrationGameModeBase *mode = AIntegrationGameModeBase::GetFromContext(context);
|
||||
FlxStreamBuffer &sb = mode->LuaCallGetBuffer();
|
||||
CheckNotEmpty(sb);
|
||||
sb.write_simple_dynamic_tag(SimpleDynamicTag::STRING);
|
||||
sb.write_fname(pname);
|
||||
}
|
||||
|
||||
void UlxLuaCallLibrary::LuaCallAddFloatParameter(UObject *context, double pfloat) {
|
||||
AIntegrationGameModeBase *mode = AIntegrationGameModeBase::GetFromContext(context);
|
||||
@@ -47,7 +54,7 @@ void UlxLuaCallLibrary::LuaCallAddVectorParameter(UObject *context, const FVecto
|
||||
sb.write_simple_dynamic_tag(SimpleDynamicTag::VECTOR);
|
||||
sb.write_fvector(pvector);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void UlxLuaCallLibrary::LuaCallAddBooleanParameter(UObject *context, bool pbool) {
|
||||
AIntegrationGameModeBase *mode = AIntegrationGameModeBase::GetFromContext(context);
|
||||
@@ -98,6 +105,7 @@ ELpxSimpleDynamicTag UlxLuaCallLibrary::LuaCallNextResultType(UObject *context)
|
||||
sb.unread_to(total_reads);
|
||||
switch (tag) {
|
||||
case SimpleDynamicTag::STRING: return ELpxSimpleDynamicTag::String;
|
||||
case SimpleDynamicTag::TOKEN: return ELpxSimpleDynamicTag::Name;
|
||||
case SimpleDynamicTag::NUMBER: return ELpxSimpleDynamicTag::Float;
|
||||
case SimpleDynamicTag::VECTOR: return ELpxSimpleDynamicTag::Vector;
|
||||
case SimpleDynamicTag::BOOLEAN: return ELpxSimpleDynamicTag::Boolean;
|
||||
@@ -110,8 +118,15 @@ FString UlxLuaCallLibrary::LuaCallGetStringResult(UObject *context) {
|
||||
FlxStreamBuffer &sb = mode->LuaCallGetResult();
|
||||
SimpleDynamicTag tag = sb.read_simple_dynamic_tag();
|
||||
if (tag != SimpleDynamicTag::STRING) FatalBlueprintError(TEXT("expected lua to return a string"));
|
||||
std::string_view s = sb.read_string_view();
|
||||
return FString(s.size(), (const UTF8CHAR *)s.data());
|
||||
return sb.read_fstring();
|
||||
}
|
||||
|
||||
FName UlxLuaCallLibrary::LuaCallGetNameResult(UObject *context) {
|
||||
AIntegrationGameModeBase *mode = AIntegrationGameModeBase::GetFromContext(context);
|
||||
FlxStreamBuffer &sb = mode->LuaCallGetResult();
|
||||
SimpleDynamicTag tag = sb.read_simple_dynamic_tag();
|
||||
if (tag != SimpleDynamicTag::TOKEN) FatalBlueprintError(TEXT("expected lua to return a name"));
|
||||
return sb.read_fname();
|
||||
}
|
||||
|
||||
double UlxLuaCallLibrary::LuaCallGetFloatResult(UObject *context) {
|
||||
|
||||
Reference in New Issue
Block a user