1 |
I wouldn't trust the quality of chicken code, and this seems to support my wariness:
|
1 |
I wouldn't trust the quality of chicken code, and this seems to support my wariness:
|
2 |
{{{_G.chickenEventArgs = {type="wave", unpack(args)}
|
2 |
{{{_G.chickenEventArgs = {type="wave", unpack(args)}
|
3 |
SendToUnsynced("ChickenEvent")
|
3 |
SendToUnsynced("ChickenEvent")
|
4 |
_G.chickenEventArgs = nil}}}
|
4 |
_G.chickenEventArgs = nil}}}
|
5 |
\n
|
5 |
\n
|
6 |
To see it done a bit better search the whole repository for the string 'HavenUpdate'. Or just follow this recipe:
|
6 |
To see it done a bit better search the whole repository for the string 'HavenUpdate'. Or just follow this recipe:
|
7 |
\n
|
7 |
\n
|
8 |
In
synced
luarules:
|
8 |
For
synced
luarules:
|
9 |
{{{SendToUnsynced("HavenUpdate", teamID, etc)}}} wherever you want to send the event.
|
9 |
{{{SendToUnsynced("HavenUpdate", teamID, etc)}}} wherever you want to send the event.
|
10 |
\n
|
10 |
\n
|
11 |
In
unsynced
luarules:
|
11 |
For
unsynced
luarules:
|
12 |
{{{gadgetHandler:AddSyncAction('HavenUpdate',WrapToLuaUI_Haven)}}} in initialize.
|
12 |
{{{gadgetHandler:AddSyncAction('HavenUpdate',WrapToLuaUI_Haven)}}} in initialize.
|
13 |
{{{gadgetHandler:RemoveSyncAction('HavenUpdate')}}} in shutdown.
|
13 |
{{{gadgetHandler:RemoveSyncAction('HavenUpdate')}}} in shutdown.
|
14 |
{{{if (Script.LuaUI('HavenUpdate')) then
|
14 |
{{{if (Script.LuaUI('HavenUpdate')) then
|
15 |
Script.LuaUI.HavenUpdate(teamID, etc)
|
15 |
Script.LuaUI.HavenUpdate(teamID, etc)
|
16 |
end}}} in {{{local function WrapToLuaUI_Haven(_, teamID, etc)}}}
|
16 |
end}}} in {{{local function WrapToLuaUI_Haven(_, teamID, etc)}}}
|
17 |
\n
|
17 |
\n
|
18 |
In
luaui:
|
18 |
For
luaui:
|
19 |
{{{widgetHandler:RegisterGlobal("HavenUpdate", HavenUpdate)}}} in initialize.
|
19 |
{{{widgetHandler:RegisterGlobal("HavenUpdate", HavenUpdate)}}} in initialize.
|
20 |
{{{widgetHandler:DeregisterGlobal("HavenUpdate", HavenUpdate)}}} in shutdown.
|
20 |
{{{widgetHandler:DeregisterGlobal("HavenUpdate", HavenUpdate)}}} in shutdown.
|
21 |
{{{local function HavenUpdate(teamID, etc)}}} to handle the event.
|
21 |
{{{local function HavenUpdate(teamID, etc)}}} to handle the event.
|
22 |
\n
|
22 |
\n
|
23 |
There is a technicality to watch out for when calling widgetHandler from widgets with 'handler = true'.
|
23 |
There is a technicality to watch out for when calling widgetHandler from widgets with 'handler = true'.
|