cocos2d-x lua 调用onEnter和onExit version: cocos2d-x 3.6 onEnter和onExit在lua中不会因节点别add和remove而直接被调用,当子节点被父节点add和remove时,会发送enter和exit的消息,所以需要再初始化节点的时候,监听消息,并在收到消息后调用onEnter或onExit. local function onNodeEvent(event) if event == "enter" then self:onEn
a.lua和b.lua在同一个目录下 a.lua调用b.lua中的test方法,注意b中test的写法 _M 和 a中调用方法: b.lua local _M = {}function _M.test() ngx.say("hello test!")endreturn _M a.lua local test = require("b")if not test then ngx.say("Failed to require b!")