static int set(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); MainBehaviourLua obj = (MainBehaviourLua)ToLua.CheckObject <MainBehaviourLua>(L, 1); obj.set(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int Set(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); MainBehaviourLua obj = (MainBehaviourLua)ToLua.CheckObject <MainBehaviourLua>(L, 1); string arg0 = ToLua.CheckString(L, 2); obj.Set(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
// Start is called before the first frame update void Start() { CreateItem("获取Lua的AB包内容", () => { Debug.Log("获取Lua的AB包内容"); readAB(); }); CreateItem("读取 define", () => { Debug.Log("define"); byte[] _bts = getLua("define"); Debug.Log(_bts.Length); }); CreateItem("创建Lua的C#脚本", () => { Debug.LogError("3--------------------------"); MainBehaviourLua _luax = (new GameObject("_luax")).AddComponent <MainBehaviourLua>(); _luax.Set("LuaTest"); }); CreateItem("创建Lua脚本,获取组件", () => { //Debug.Log("3"); MainBehaviourLua _luax = (new GameObject("_luax")).AddComponent <MainBehaviourLua>(); _luax.Set("LuaTest"); }); CreateItem("创建Lua脚本,父子关系的体现", () => { //Debug.Log("3"); MainBehaviourLua _luax = (new GameObject("_luax")).AddComponent <MainBehaviourLua>(); _luax.Set("LuaTest");//这里填写的是Lua脚本的名字就可以咯,(本地脚本使用脚本查找方式,找到完整路径下的脚本,如果是AB包中,直接传入名称即可) }); m_item.gameObject.SetActive(false); }