Skip to content

Commit

Permalink
fixed errors in android platform。
Browse files Browse the repository at this point in the history
  • Loading branch information
zjhongxian committed May 11, 2023
1 parent 11a8066 commit 2cd19bc
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include "LuaFunctionAccelerator.h"
#include "LuaObject.h"
#include "LuaState.h"
#include "LuaVar.h"
#include "SluaUtil.h"

ULuaDelegate::ULuaDelegate(const FObjectInitializer& ObjectInitializer)
Expand Down Expand Up @@ -138,7 +137,10 @@ namespace NS_SLUA {

if (!map.Contains(obj) || !obj->IsValidLowLevel())
{
#if UE_BUILD_DEVELOPMENT
luaL_error(L, "Invalid ULuaDelegate!");
#endif
return 0;
}

FScriptDelegate Delegate;
Expand Down
1 change: 1 addition & 0 deletions Plugins/slua_unreal/Source/slua_unreal/Public/LuaArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#include "SluaMicro.h"
#include "lua.h"
#include "lauxlib.h"
#include "UObject/UnrealType.h"
#include "UObject/GCObject.h"
#include "PropertyUtil.h"
Expand Down
8 changes: 4 additions & 4 deletions Plugins/slua_unreal/Source/slua_unreal/Public/LuaBitArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,21 @@ class SLUA_UNREAL_API LuaBitArray

friend FArchive& operator<<(FArchive& Ar, const LuaBitArray& A)
{
int32 BitSize = 0;
int32 RealBitSize = 0;
if (Ar.IsSaving())
{
for (int32 Index = A.BitSize - 1; Index >= 0; --Index)
{
if (A.BitData[Index] != 0)
{
BitSize = Index + 1;
RealBitSize = Index + 1;
break;
}
}
}

Ar << BitSize;
for (int32 Index = 0; Index < BitSize; ++Index)
Ar << RealBitSize;
for (int32 Index = 0; Index < RealBitSize; ++Index)
{
if (Index < A.BitSize)
{
Expand Down
5 changes: 1 addition & 4 deletions Plugins/slua_unreal/Source/slua_unreal/Public/LuaDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@
#include "CoreMinimal.h"
#include "LuaObject.h"
#include "lua.h"
#include "LuaVar.h"
#include "LuaDelegate.generated.h"

namespace NS_SLUA {
class LuaVar;
}

UCLASS()
class SLUA_UNREAL_API ULuaDelegate : public UObject {
GENERATED_UCLASS_BODY()
Expand Down
1 change: 1 addition & 0 deletions Plugins/slua_unreal/Source/slua_unreal/Public/LuaMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#pragma once

#include "lua.h"
#include "lauxlib.h"
#include "SluaMicro.h"
#include "UObject/UnrealType.h"
#include "UObject/GCObject.h"
Expand Down
12 changes: 2 additions & 10 deletions Plugins/slua_unreal/Source/slua_unreal/Public/LuaObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,6 @@
#define SLUA_CPPINST "__cppinst"
#endif

#ifndef FORCE_INLINE
#if WITH_EDITOR
#define SLUA_FORCE_INLINE
#else
#define SLUA_FORCE_INLINE FORCEINLINE
#endif
#endif

// checkUD will report error if ud had been freed
#define CheckUD(Type,L,P) auto UD = LuaObject::checkUD<Type>(L,P);
// UD may be freed by Engine, so skip it in gc phase
Expand Down Expand Up @@ -362,8 +354,8 @@ namespace NS_SLUA {

static int classIndex(lua_State* L);
static int classNewindex(lua_State* L);
SLUA_FORCE_INLINE static int objectIndex(lua_State* L, UObject* obj, const char* name, bool cacheToLua=false);
SLUA_FORCE_INLINE static bool objectNewIndex(lua_State* L, UObject* obj, const char* name, int valueIdx, bool checkValid = true);
static int objectIndex(lua_State* L, UObject* obj, const char* name, bool cacheToLua=false);
static bool objectNewIndex(lua_State* L, UObject* obj, const char* name, int valueIdx, bool checkValid = true);

static void newType(lua_State* L, const char* tn);
static void newTypeWithBase(lua_State* L, const char* tn, std::initializer_list<const char*> bases);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ namespace NS_SLUA
void onAsyncLoadingFlushUpdate();
void onEngineGC();

bool bindOverrideFuncs(const UObjectBase* obj, UClass* cls, bool bHookInstancedObj);
bool bindOverrideFuncs(const UObjectBase* objBase, UClass* cls, bool bHookInstancedObj);
void setmetatable(const LuaVar& luaSelfTable, void* objPtr);

bool hookBpScript(UFunction* func, UClass* cls, FNativeFuncPtr hookFunc);
Expand Down
3 changes: 2 additions & 1 deletion Plugins/slua_unreal/Source/slua_unreal/Public/PropertyUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and limitations under the License.
#pragma once

#include "SluaMicro.h"
#if (ENGINE_MINOR_VERSION<25) && (ENGINE_MAJOR_VERSION<=4)
#include "UObject/WeakObjectPtr.h"
#else
#include "UObject/WeakFieldPtr.h"
#endif
#include "SluaMicro.h"

#if !((ENGINE_MINOR_VERSION<22) && (ENGINE_MAJOR_VERSION==4))
#include "EPropertyClassUEnum.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public slua_unreal(ReadOnlyTargetRules Target) : base(Target)
else if (Target.Platform == UnrealTargetPlatform.Android)
{
#if UE_4_24_OR_LATER
PublicAdditionalLibraries.Add(Path.Combine(externalLib, "Android/armeabi-arm64/liblua.a"));
PublicAdditionalLibraries.Add(Path.Combine(externalLib, "Android/armeabi-v7a/liblua.a"));
PublicAdditionalLibraries.Add(Path.Combine(externalLib, "Android/armeabi-arm64/liblua.a"));
PublicAdditionalLibraries.Add(Path.Combine(externalLib, "Android/x86/liblua.a"));
#else
PublicLibraryPaths.Add(Path.Combine(externalLib, "Android/armeabi-arm64"));
Expand Down
3 changes: 1 addition & 2 deletions Source/democpp/MyGameInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
#include "Misc/Paths.h"
#include "HAL/PlatformFileManager.h"
#include "GenericPlatform/GenericPlatformFile.h"
#include "HAL/FileManager.h"

#include "Misc/FileHelper.h"


// read file content
Expand Down

0 comments on commit 2cd19bc

Please sign in to comment.