zyroad Posted October 30, 2012 Posted October 30, 2012 I have a lua function need to be called when the driver is loaded. Where should I put its into?---------------------In the c4i-----------------<script><![CDATA[blobs = {}function blobs.Initialize() blobs.num = 0 print("InitBlobs") blobs[blobs.num+1]=C4:GetBlobByName(string.format("B%04d",blobs.num)) while blobs[blobs.num+1] do blobs.num = blobs.num+1 blobs[blobs.num+1]=C4:GetBlobByName(string.format("B%04d",blobs.num)) endend-------------function SZL.Initialize(nProfileID, tValidClusterIDs, nGroupID, nSourceEndpoint, nDestEndpoint, nDestEndpoint2) SZL.ResetSequenceNumber() -- Fill in for your device... SZL.gMyProfileID = nProfileID SZL.gMyValidClusterIDs = {} for k,v in pairs(tValidClusterIDs) do SZL.gMyValidClusterIDs[v] = k end SZL.Endpoints = {} SZL.gMyGroupID = nGroupID -- Endpoints are usually by cluster, but these are the default if not set... SZL.gMySE = nSourceEndpoint SZL.gMyDE = nDestEndpoint SZL.gMyDE2 = nDestEndpoint2 blobs.Initialize() ----can't work when called here, this is strange.end---------------------------function OnPropertyChanged(strProperty) blobs.Initialize() ----can work when called here, but I need to change some property first. print(blobs.num) ----use this to monitor if the blobs.Initialize() is called print(SZL.gMySE) ----use this to monitor if the SZL.Initialize() is calledend--------------------------SZL.Initialize(0x104, { SZL.ClusterID.Basic, SZL.ClusterID.Identify, SZL.ClusterID.Groups, SZL.ClusterID.Scenes, SZL.ClusterID.OnOff, SZL.ClusterID.LevelControl, SZL.ClusterID.Time }, 0, 10, 11, 12) -----can work, but nested blobs.Initialize() function is not called, it's very strangeblobs.Initialize() ----can't work when call here]]></script>
Recommended Posts
Archived
This topic is now archived and is closed to further replies.