Skip to content

Commit d1d8173

Browse files
committed
Explain extending CMD.
1 parent a550e47 commit d1d8173

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

rts/Lua/LuaConstCMD.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,22 @@
1818
* master list of command IDs.
1919
* - Also supports integer keys, and those perform reverse mapping of command IDs.
2020
*
21+
* The table can be extended by games through lua, in order to define custom
22+
* commands.
23+
*
24+
* To extend, do:
25+
*
26+
* ```LUA
27+
* local MY_CUSTOM_COMMAND = 57600 -- avoid conflicts
28+
* CMD['MY_CUSTOM_COMMAND'] = MY_CUSTOM_COMMAND
29+
* CMD[MY_CUSTOM_COMMAND] = 'MY_CUSTOM_COMMAND'
30+
* ```
31+
*
32+
* For now there is no mechanism to avoid id conflicts, so you will have
33+
* to be careful. Also you should put this code in a place where both
34+
* Synced, Unsynced, and all lua environments can import it, otherwise
35+
* it won't be available everywhere.
36+
*
2137
* @see Spring.GiveOrderToUnit
2238
* @see Spring.GiveOrderToUnitArray
2339
* @enum CMD

0 commit comments

Comments
 (0)