From b0df264529e397bbf5dc81ab7feae75de6bef19f Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 25 Jul 2022 16:46:33 +0200 Subject: [PATCH] new lua events --- Source/system/{update.lua => onUpdate.lua} | 0 Source/unit/{start.lua => onStart.lua} | 0 config.json | 118 +-------------------- 3 files changed, 1 insertion(+), 117 deletions(-) rename Source/system/{update.lua => onUpdate.lua} (100%) rename Source/unit/{start.lua => onStart.lua} (100%) diff --git a/Source/system/update.lua b/Source/system/onUpdate.lua similarity index 100% rename from Source/system/update.lua rename to Source/system/onUpdate.lua diff --git a/Source/unit/start.lua b/Source/unit/onStart.lua similarity index 100% rename from Source/unit/start.lua rename to Source/unit/onStart.lua diff --git a/config.json b/config.json index d2d587b..3886e6d 100644 --- a/config.json +++ b/config.json @@ -1,117 +1 @@ -{ - "slots": { - "0": { - "name": "slot1", - "type": { - "events": [], - "methods": [] - } - }, - "1": { - "name": "slot2", - "type": { - "events": [], - "methods": [] - } - }, - "2": { - "name": "slot3", - "type": { - "events": [], - "methods": [] - } - }, - "3": { - "name": "slot4", - "type": { - "events": [], - "methods": [] - } - }, - "4": { - "name": "slot5", - "type": { - "events": [], - "methods": [] - } - }, - "5": { - "name": "slot6", - "type": { - "events": [], - "methods": [] - } - }, - "6": { - "name": "slot7", - "type": { - "events": [], - "methods": [] - } - }, - "7": { - "name": "slot8", - "type": { - "events": [], - "methods": [] - } - }, - "8": { - "name": "slot9", - "type": { - "events": [], - "methods": [] - } - }, - "9": { - "name": "slot10", - "type": { - "events": [], - "methods": [] - } - }, - "-1": { - "name": "unit", - "type": { - "events": [], - "methods": [] - } - }, - "-2": { - "name": "system", - "type": { - "events": [], - "methods": [] - } - }, - "-3": { - "name": "library", - "type": { - "events": [], - "methods": [] - } - } - }, - "handlers": [ - { - "code": "--[[\n DU-Nested-Coroutines by Jericho\n Permit to easier avoid CPU Load Errors\n Source available here: https://github.com/Jericho1060/du-nested-coroutines\n]]--\n\ncoroutinesTable = {}\n--all functions here will become a coroutine\nMyCoroutines = {\n function()\n for i=0, 10 do\n system.print(\"function 1 --- \"..i)\n coroutine.yield(coroutinesTable[1])--start with index 1 and so on\n end\n end,\n function()\n for i=0, 10 do\n system.print(\"function 2 --- \"..i)\n coroutine.yield(coroutinesTable[2])--the second fonction yiel is with index 2\n end\n end\n}\n\nfunction initCoroutines()\n for _,f in pairs(MyCoroutines) do\n local co = coroutine.create(f)\n table.insert(coroutinesTable, co)\n end\nend\n\ninitCoroutines()\n\nrunCoroutines = function()\n for i,co in ipairs(coroutinesTable) do\n if coroutine.status(co) == \"dead\" then\n coroutinesTable[i] = coroutine.create(MyCoroutines[i])\n end\n if coroutine.status(co) == \"suspended\" then\n assert(coroutine.resume(co))\n end\n end\nend\n\nMainCoroutine = coroutine.create(runCoroutines)", - "filter": { - "args": [], - "signature": "start()", - "slotKey": "-1" - }, - "key": "0" - }, - { - "code": "--[[\n DU-Nested-Coroutines by Jericho\n Permit to easier avoid CPU Load Errors\n Source available here: https://github.com/Jericho1060/du-nested-coroutines\n]]--\n\nif coroutine.status(MainCoroutine) == \"dead\" then\n MainCoroutine = coroutine.create(runCoroutines)\nend\nif coroutine.status(MainCoroutine) == \"suspended\" then\n assert(coroutine.resume(MainCoroutine))\nend", - "filter": { - "args": [], - "signature": "update()", - "slotKey": "-2" - }, - "key": "1" - } - ], - "methods": [], - "events": [] -} \ No newline at end of file +{"events":[],"handlers":[{"code":"--[[\n DU-Nested-Coroutines by Jericho\n Permit to easier avoid CPU Load Errors\n Source available here: https://github.com/Jericho1060/du-nested-coroutines\n]]--\n\nif coroutine.status(MainCoroutine) == \"dead\" then\n MainCoroutine = coroutine.create(runCoroutines)\nend\nif coroutine.status(MainCoroutine) == \"suspended\" then\n assert(coroutine.resume(MainCoroutine))\nend","filter":{"args":[],"signature":"onUpdate()","slotKey":"-4"},"key":"1"},{"code":"--[[\n DU-Nested-Coroutines by Jericho\n Permit to easier avoid CPU Load Errors\n Source available here: https://github.com/Jericho1060/du-nested-coroutines\n]]--\n\ncoroutinesTable = {}\n--all functions here will become a coroutine\nMyCoroutines = {\n function()\n for i=0, 10 do\n system.print(\"function 1 --- \"..i)\n coroutine.yield(coroutinesTable[1])--start with index 1 and so on\n end\n end,\n function()\n for i=0, 10 do\n system.print(\"function 2 --- \"..i)\n coroutine.yield(coroutinesTable[2])--the second fonction yiel is with index 2\n end\n end\n}\n\nfunction initCoroutines()\n for _,f in pairs(MyCoroutines) do\n local co = coroutine.create(f)\n table.insert(coroutinesTable, co)\n end\nend\n\ninitCoroutines()\n\nrunCoroutines = function()\n for i,co in ipairs(coroutinesTable) do\n if coroutine.status(co) == \"dead\" then\n coroutinesTable[i] = coroutine.create(MyCoroutines[i])\n end\n if coroutine.status(co) == \"suspended\" then\n assert(coroutine.resume(co))\n end\n end\nend\n\nMainCoroutine = coroutine.create(runCoroutines)","filter":{"args":[],"signature":"onStart()","slotKey":"-1"},"key":"0"}],"methods":[],"slots":{"0":{"name":"slot1","type":{"events":[],"methods":[]}},"1":{"name":"slot2","type":{"events":[],"methods":[]}},"2":{"name":"slot3","type":{"events":[],"methods":[]}},"3":{"name":"slot4","type":{"events":[],"methods":[]}},"4":{"name":"slot5","type":{"events":[],"methods":[]}},"5":{"name":"slot6","type":{"events":[],"methods":[]}},"6":{"name":"slot7","type":{"events":[],"methods":[]}},"7":{"name":"slot8","type":{"events":[],"methods":[]}},"8":{"name":"slot9","type":{"events":[],"methods":[]}},"9":{"name":"slot10","type":{"events":[],"methods":[]}},"-5":{"name":"library","type":{"events":[],"methods":[]}},"-4":{"name":"system","type":{"events":[],"methods":[]}},"-3":{"name":"player","type":{"events":[],"methods":[]}},"-2":{"name":"construct","type":{"events":[],"methods":[]}},"-1":{"name":"unit","type":{"events":[],"methods":[]}}}} -- 2.54.0