asqbtcupid / unreal.lua

lua solution for UnrealEngine4
MIT License
300 stars 98 forks source link

luacallr when the type of return value is struct, compile error #16

Closed mirchd closed 6 years ago

mirchd commented 6 years ago

my struct: USTRUCT() struct FFormation { GENERATED_BODY()

FFormation()
{

}

// sort
UPROPERTY()
TArray<FBattleShip> sortShipArr;

};

when compile at "luacallr(FFormation, ...." it match template static T popinternal(lua_State L, int index, typename TEnableIf< TIsSame<typename traitstructclass::NotStructType, NotNeedTempInsType>::Value,T>::Type pp = nullptr ) { return (T)ue_lua_tointeger(L, index); };

please help

asqbtcupid commented 6 years ago

you have to #include "Formation.lua.h", struct is special.

mirchd commented 6 years ago

it is resolved, thanks

mirchd commented 6 years ago

and subclass also compile error. UCLASS() class AArmyShipActor : public AActor { GENERATED_BODY()

public: UPROPERTY(EditDefaultsOnly, Category = "CannonFire") TSubclassOf ProjectileClass; };

class AMissileActor : public AActor

when link, it says " AMissileActor::GetPrivateStaticClass can be find,

asqbtcupid commented 6 years ago

UCLASS() class YOUR_GAMEMODULE_API AArmyShipActor : public AActor { GENERATED_BODY() }

your class is not a api class, you should add YOUR_GAMEMODULE_API macro.Have a look to engine's class declaration.

mirchd commented 6 years ago

it is ok~thank you very much

mirchd commented 6 years ago

Is LuaDebugger plugin can be used in visual studio? and may I debug lua in ue4?

asqbtcupid commented 6 years ago

in ue4 editor, click windows -> LuaDebugger.Then open the debugger.

mirchd commented 6 years ago

thanks,I'll try it~