Comments (13)
你为什么要放Resoures目录下呢,通过TextAsset直接引用的了。处理热更新的例子,全部例子都不用做任何事情,直接运行。
另外,你改了LuaBehaviour.cs?应该不会出现self为nil的情况呀?
from xlua.
你好,是这样的,我看到XLua教程.doc 文档开头说,DoString("require 'byfile'") ,更建议这种方式, 我尝试了一下。
我只修改了LuaBehaviour.cs那一行代码。然后移动lua文件到Resources目录里,与第7个例子,相同的目录结构。
from xlua.
你看看LuaBehaviour.cs,这几行都存在吗?
scriptEnv = luaEnv.NewTable();
LuaTable meta = luaEnv.NewTable();
meta.Set("__index", luaEnv.Global);
scriptEnv.SetMetaTable(meta);
meta.Dispose();
scriptEnv.Set("self", this);
from xlua.
哦,我知道了
luaEnv.DoString(luaScript.text, "LuaBehaviour", scriptEnv);
没传scriptEnv参数
from xlua.
那几行代码都在的,我没有动其他代码,只换成了require方式。
from xlua.
要加后面两个参数
DoString("require 'byfile'","LuaBehaviour", scriptEnv )
from xlua.
scriptEnv不会自动设置给require的文件。。这个例子你不能通过require 方式,要require你得通过别的方式来传状态
from xlua.
DoString("require 'byfile'","LuaBehaviour", scriptEnv ) 我第一条留言里已经改过了。
恩,谢谢,我知道require的用法了。
有相关xlua的qq群吗?
from xlua.
QQ群暂时还没有,建群了通知你
from xlua.
好的,谢谢。
from xlua.
@lemon-li 刚建了QQ群:612705778
from xlua.
hi~方便问一下这个问题怎么解决么?
刚学lua,说得不对的话请见谅。
lua在加载一个新的模块的时候,其_ENV应该默认等于upvalue里面的_ENV。
那么在require一个模块的时候,这个模块的_ENV应该等于scriptEnv才对吧。
这算不算bug?
from xlua.
@delguoqing 算不算bug,你下载个原版的lua5.3试试就可以了,如果和原版的不一样,就是bug,否则不算。
from xlua.
Related Issues (20)
- "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对象销毁问题
- unity2022生成wrap代码时报错 HOT 1
- 无法在包含 IntPtr 的结构体上使用 GCOptimize
- unity2021正常,unity2022,new LuaEnv();就报错。 HOT 1
- 如何将枚举值转换为其基础类型? HOT 1
- 开启了热更新后,游戏内切场景时间多花了3秒,从12秒变成15秒,这个性能正常吗
- 如何在 Lua 中获取给定 Dictionary<,> 值的所有键?
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.