Loading...
  OR  Zero-K Name:    Password:   

Post edit history

Need some LUA Widget scripting help

To display differences between versions, select one or more edits in the list using checkboxes and click "diff selected"
Post edit history
Date Editor Before After
1/24/2019 5:08:20 AMunknownrankShaman before revert after revert
Before After
1 Hi there. Welcome to the lua wizardry club. 1 Hi there. Welcome to the lua wizardry club.
2 \n 2 \n
3 ---- 3 ----
4 \n 4 \n
5 local Pull = 0 5 local Pull = 0
6 ... 6 ...
7 GiveOrderToUnit (unitID, CMD_PUSH_PULL, {Pull}, 0) 7 GiveOrderToUnit (unitID, CMD_PUSH_PULL, {Pull}, 0)
8 \n 8 \n
9 [quote] 9 [quote]
10 local Pull = {0} 10 local Pull = {0}
11 \n 11 \n
12 GiveOrderToUnit(unitID,CMD_PUSH_PULL, Pull,0) 12 GiveOrderToUnit(unitID,CMD_PUSH_PULL, Pull,0)
13 [/quote] 13 [/quote]
14 \n 14 \n
15 Recreating a table every time you call this is insanity. It's very expensive to create a table. Now imagine how expensive it is to create a table every time you're using this callout. This is an optimization though. Basically good points: 15 Recreating a table every time you call this is insanity. It's very expensive to create a table. This is an optimization though. Basically good points:
16 \n 16 \n
17 * Using speedups is both good for your personal timesaving AND good for performance! Speedups are ~47-58% faster iirc. 17 * Using speedups is both good for your personal timesaving AND good for performance! Speedups are ~47-58% faster iirc.
18 * Try to keep tables around you're going to be reusing. 18 * Try to keep tables around you're going to be reusing.
19 \n 19 \n
20 ---- 20 ----
21 \n 21 \n
22 [quote] 22 [quote]
23 if Spring.GetSpectatingState() then 23 if Spring.GetSpectatingState() then
24 widgetHandler:RemoveWidget() 24 widgetHandler:RemoveWidget()
25 end 25 end
26 [/quote] 26 [/quote]
27 \n 27 \n
28 Move this to Initialize() and PlayerChanged(playerID) [?]. It doesn't belong in UnitFinished. Just don't need this check happening every time a unit is finished. 28 Move this to Initialize() and PlayerChanged(playerID) [?]. It doesn't belong in UnitFinished. Just don't need this check happening every time a unit is finished.