debugable-unlua's Introduction
debugable-unlua's People
Forkers
ahsan-muzaheed monkqq haitor888 yzx4036 robinhood90 wang1986one fdcumt jeveruberry 954938776 luoxz-ai sunguangdong brogii takalard jyfhub snadax fgd4dajkg ba3000 githubbadguy elendil1529 guozanhua kgtyrael hengle guozanhua218 gamazzzz reliath baikety eastnight oscargame linecode xueliuxing28 melancholy-yolk kalading2 llmunitygamedevelopment llmunrealengine4gamesdebugable-unlua's Issues
Ufunction 返回TArray const引用时没有数据, 返回非const引用时实际上依然是返回了拷贝
总体来说,发现问题产生的主要原因,是因为当返回const引用类型是,使用bCreateCopy为false创建了一个FLuaArray,然后在
Properties[i]->DestroyValue(Params);中销毁了对应的FScriptArray导致实际上返回的FLuaArray持有了一个被销毁的FScriptArray
UHT生成返回const引用的类型标记了 CPF_InstancedReference ,普通引用的没有标记,所以普通引用返回值实际上还是走的拷贝
测试类
UCLASS()
class WIDGETEXTEND_API UNTileView : public UTileView
{
GENERATED_BODY()
public:
UNTileView(const FObjectInitializer& ObjectInitializer);
virtual void ReleaseSlateResources(bool bReleaseChildren) override;
UFUNCTION(BlueprintCallable)
TArray<UObject*> GetItemTest() {
return GetListItems();
}
UFUNCTION(BlueprintCallable)
TArray<int32>& GetTestArr() {
return TestArr;
}
UFUNCTION(BlueprintCallable)
TArray<int32> GetTestArr2() {
return TestArr;
}
UFUNCTION(BlueprintCallable)
const TArray<int32>& GetTestArr3() const {
return TestArr;
}
UPROPERTY()
TArray<int32> TestArr;
};
FArrayPropertyDesc在构建 FLuaArray 针对 bCreateCopy进行了不同的操作,引用类型直接使用了ValuePtr内存中的FScriptArray
virtual void GetValueInternal(lua_State *L, const void *ValuePtr, bool bCreateCopy) const override
{
if (bCreateCopy)
{
FScriptArray *ScriptArray = new FScriptArray;
//ArrayProperty->InitializeValue(ScriptArray);
ArrayProperty->CopyCompleteValue(ScriptArray, ValuePtr);
void *Userdata = NewScriptContainer(L, FScriptContainerDesc::Array);
new(Userdata) FLuaArray(ScriptArray, InnerProperty, FLuaArray::OwnedBySelf);
}
else
{
FScriptArray *ScriptArray = (FScriptArray*)(&ArrayProperty->GetPropertyValue(ValuePtr));
void *Userdata = CacheScriptContainer(L, ScriptArray, FScriptContainerDesc::Array);
if (Userdata)
{
FLuaArray *LuaArray = new(Userdata) FLuaArray(ScriptArray, (TLuaContainerInterface<FLuaArray>*)this, FLuaArray::OwnedByOther);
((TLuaContainerInterface<FLuaArray>*)this)->AddContainer(LuaArray);
}
}
}
然后在 Properties[i]->DestroyValue(Params); 被销毁了。。。
void FArrayProperty::DestroyValueInternal( void* Dest ) const
{
FScriptArrayHelper ArrayHelper(this, Dest);
ArrayHelper.EmptyValues();
//@todo UE4 potential double destroy later from this...would be ok for a script array, but still
ArrayHelper.DestroyContainer_Unsafe();
}
socket库
只看到了luaPanda .start,不用释放端口吗?
比如第二次调试的时候,怎么办?
更新LuaPanda到3.2
因为单个LuaPanda.lua在include时文件太长不可以直接包含,所以我写了个工具把LuaPanda.lua的内容转换为了LuaPanda.inl
请问能升一下级, 或者也开源一下转换的工具吗? 谢谢
master報錯,找不到這個,用的4.25 ADD_STATIC_FUNCTION_EX("ProjectSavedDir", FString, ProjectSavedDir)
master報錯,找不到這個,用的4.25 ADD_STATIC_FUNCTION_EX("ProjectSavedDir", FString, ProjectSavedDir)
通过Add_reg宏手工注册的类型,其代码提示如何导出?
unlua editor模块当中有一个commmandlet,应该如何使用?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.