Comments (6)
你要先判空,空的话直接OnOpen=function。
貌似c#下也是会报错的吧,如果左值为null的话
from xlua.
delegate可以用'+'么?我以为只有event可以那样写。
from xlua.
ws.OnOpen = ws.OnOpen + function() end
另外,你那个delegate要加CSharpCallLua
from xlua.
其实在教程都有,最好去看看
from xlua.
不好意思,教程里面我看歪了。
把delegate的+链接和event混了。
from xlua.
LuaException: [string "WebsocketTest.lua"]:24: attempt to perform arithmetic on a nil value (field 'OnClosed')
stack traceback:
[string "WebsocketTest.lua"]:24: in function <[string "WebsocketTest.lua"]:10>
XLua.LuaEnv.ThrowExceptionFromError (Int32 oldTop) (at Assets/xLua/Src/LuaEnv.cs:360)
XLuaGenDelegateImpl0.Invoke2 ()
LuaBehaviour.Start () (at Assets/_LFramework/Scripts/Common/LuaBehaviour.cs:70)
教程里面中的是ok的,但是这个是说 on a nil value,已经在delegate中加入CSharpCallLua,而且我调用ws.IsOpen的bool值不会有问题
from xlua.
Related Issues (20)
- [Hotfix] 有时需要放到非Editor目录才生效
- 内存泄漏严重 HOT 3
- Disabling Domain Reload causes crashes and strange behaviour
- Unity2022.3.16 IOS 打包 报错
- 最新版本支持多asmdef功能revert? HOT 1
- iOS编译报错 duplicate symbol '_luaopen_bit'
- "SymbolsNotMatchingException" occurs when performing Obfuscator after HotFix Injection.
- 想编译Nintendo Switch平台用的XLua版本 HOT 1
- 鸿蒙平台导出包报错
- ps4平台编译xlua不通过 HOT 1
- 添加HOTFIX_ENABLE宏,在主线程中调用GC.WaitForPendingFinalizers导致死锁,有什么推荐修改方案吗? HOT 4
- 代码里using了UnityEngine.Purchasing.Security命名空间导致Android打包inject失败
- self.gameObject无法访问 HOT 2
- xLua适配 OpenHarmony 平台吗 HOT 1
- Unity2022.3.17发布WebGL后运行报错 HOT 1
- 使用ExampleConfig.cs中的热更新Delegate配置,会使C#方法通过反射调用
- webgl平台下如何自定义异步加载loader HOT 2
- webgl微信小程序打包出现错误,求帮助 HOT 1
- 集成第三方库,在webgl平台要怎么处理? HOT 1
- Xlua中非UnityObject对象销毁问题
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.
from xlua.