Skip to content
User Avatar
#1357
Auto-translated
Here's an example of code that should definitely not be written this way (it's very poor handwriting, resembling machine code):
gold=gold>0 and gold or 0

And here's how it should be written, making it both functional and readable:
TAX_GOLD = 10000
...
local playerGold = GetPlayerResource(PLAYER_1, GOLD)
if (playerGold > TAX_GOLD) then
local newPlayerGold = playerGold - TAX_GOLD
SetPlayerResource(PLAYER_1, GOLD, newPlayerGold)
else
SetPlayerResource(PLAYER_1, GOLD, 0)
end
Разработчик Heroes 5.5 WarGame Edition.
Сайт проекта - пока неактивен
Автор Асимметричных шахмат