Overhaul the handling of return values in LuaProbe
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "ConsoleOutput.h"
|
||||
#include "Tangible.h"
|
||||
#include "TangibleManager.h"
|
||||
#include "LuaCall.h"
|
||||
#include "Blueprint/UserWidget.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
|
||||
@@ -168,29 +169,35 @@ void ALuprexGameModeBase::UpdatePossessedTangible() {
|
||||
}
|
||||
}
|
||||
|
||||
void ALuprexGameModeBase::LuaCallEnd(InvocationKind kind, int64 place_id) {
|
||||
UlxLuaValues *ALuprexGameModeBase::LuaCallEnd(InvocationKind kind, int64 place_id) {
|
||||
std::string_view datapk = LuaCallBuffer.view();
|
||||
FlxLockedWrapper w(LockableWrapper);
|
||||
if (place_id == 0) place_id = w.GetActor();
|
||||
uint32_t retpklen;
|
||||
const char *retpk;
|
||||
w->play_call_function(w.Get(), kind, place_id, datapk.size(), datapk.data(), &retpklen, &retpk);
|
||||
LuaCallResult.open(std::string_view(retpk, retpklen));
|
||||
if (kind == InvocationKind::LUA_PROBE)
|
||||
{
|
||||
UlxLuaValues *Result = NewObject<UlxLuaValues>(this);
|
||||
Result->Initialize(std::string_view(retpk, retpklen));
|
||||
return Result;
|
||||
}
|
||||
else return nullptr;
|
||||
}
|
||||
|
||||
void ALuprexGameModeBase::LuaCallEnd(InvocationKind kind) {
|
||||
LuaCallEnd(kind, int64(0));
|
||||
UlxLuaValues *ALuprexGameModeBase::LuaCallEnd(InvocationKind kind) {
|
||||
return LuaCallEnd(kind, int64(0));
|
||||
}
|
||||
|
||||
void ALuprexGameModeBase::LuaCallEnd(InvocationKind kind, AActor *place) {
|
||||
UlxLuaValues *ALuprexGameModeBase::LuaCallEnd(InvocationKind kind, AActor *place) {
|
||||
if (place == nullptr) {
|
||||
LuaCallEnd(kind, int64(0));
|
||||
return LuaCallEnd(kind, int64(0));
|
||||
} else {
|
||||
UlxTangible *tan = UlxTangible::GetActorTangibleOrLog(place);
|
||||
if (tan == nullptr) {
|
||||
LuaCallResult.clear();
|
||||
return NewObject<UlxLuaValues>(this);
|
||||
} else {
|
||||
LuaCallEnd(kind, tan->TangibleId);
|
||||
return LuaCallEnd(kind, tan->TangibleId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user