Closed mirchd closed 6 years ago
wow, It's real a bug. for now,you can add some data to rect2d,i will fix it later.
struct XX_API FRect2D
{
GENERATED_BODY()
UPROPERTY()
FVector2D dummy;
UPROPERTY()
FVector2D origin;
UPROPERTY()
FVector2D size;
}
UPROPERTY() FVector2D dummy; some other user define struct is also need to add these lines? how it cause this bug?
because the address of FRect2D is the same as FRect2D.origin. So when you get the origin,the lua treat it as FRect2D. This bug happen only when you get the first member of a struct, and the type of the member is a struct too. I will fix it tonight.
understood I'll modify my code,thanks
fixed
struct XX_API FRect2D { GENERATED_BODY()
}
FRect2D test FRect2D pInfo = &test; ... LuaCall("openInfoUI", this, pInfo);
.lua
function openInfoUI(info) local tmpOri = info:luaGet_origin() local tmpX = info:luaGet_origin():luaGet_X() end
error: attempt to call method 'LuaGet_X' (a nil value)...
on lua debug, the value of origin from "tmpOri" is wrong. the meta strcut of tmpOri is not FVector2D,which is FRect2D now.
please help,