• 2024-03-07xlua - 增加protobuf库
    lua下常用的2个protobuf库1) GitHub-starwing/lua-protobuf:ALuamoduletoworkwithGoogleprotobuf2) GitHub-cloudwu/pbc:AprotocolbufferslibraryforC这边使用第1个库 a)下载lua-protobuf源码,并解压到xlua的build文件夹根目录 b)CMakeLists.txt中
  • 2024-03-03xlua - 增加lua-cjson库
    xlua貌似不支持单独动态加载cjson.dll,试了各种方式,都是会造成Unity闪退,也不知道原因。解决办法就是直接编译进xlua.dll 1)下载lua-cjson源码,并解压到xlua的build文件夹根目录GitHub-openresty/lua-cjson:LuaCJSONisafastJSONencoding/parsingmoduleforLua 2
  • 2024-02-29lua协程 - 把回调模式的代码流程改成顺序执行流程
    像ugui的点击按钮,然后触发相关逻辑,都是回调模式的写法,比如下面代码的ShowAlert调用publicclassTest7:MonoBehaviour{publicGameObjectm_Alert;publicTextm_TxtMsg;publicButtonm_BtnYes;publicButtonm_BtnNo;privateLuaEnvm_LuaEnv;
  • 2024-02-29xlua - lua调用c#函数
    c#部分publicclassTest5Obj{publicinti;privatestringstr;publicTest5Obj(){}publicvoidPrintInt(){Debug.Log($"c#PrintInt:{i}");}publicvoidPrintStr(){Debug.Log($"c#Prin
  • 2024-02-28xlua - lua协程与Unity协程
    lua脚本:Assets/Lua/Test3.lua.txtlocalmove_end={}localLuaEnumeratorImpl={}LuaEnumeratorImpl.__index=LuaEnumeratorImplfunctionLuaEnumeratorImpl.new(coRun)localobj={}setmetatable(obj,LuaEnumeratorImpl)obj:ctor(coRun)retu
  • 2024-02-28xlua - c#访问lua函数
    lua代码Assets/Lua/Test1.lua.txtfunctionIntParam(p)print("~~~~~IntParam")print(type(p),p)print("~~~~~")returnpendfunctionVec3Param(p)print("~~~~~Vec3Param")print(type(p),p.x,p.y,p.z)
  • 2023-03-19【Lua】xLua逻辑热更新
    1前言​Lua基础语法中系统介绍了Lua的语法体系,ToLua逻辑热更新中介绍了ToLua的应用,本文将进一步介绍Unity3D中基于xLua实现逻辑热更新。​逻辑热更新
  • 2022-12-08Lua文件加载
    XLua只是提供Lua在Unity上运行,并没有提供热更行解决方案。Lua文件加载加载字符串直接使用luaEnv.DoString()执行一个字符串,字符串必须符合Lua语法但加载字符串这个方
  • 2022-11-11【热更新实践】xLua基本用法
    这边文章是看xlua官方教程和一些文档之后的一个总结,希望大家都能学会lua,当然最希望我能快点学会lua。。。C#调用Lua(1)LuaEnvLuaEnv是C#中调用lua时需要用到的lua环境提示,需
  • 2022-11-01unity3d:xlua 加载自定义Loader
    在xLua加自定义loader是很简单的,只涉及到一个接口:publicdelegatebyte[]CustomLoader(refstringfilepath);publicvoidLuaEnv.AddLoader(CustomLoaderloader)通过A