Ludii Forum
Strange macro error - Printable Version

+- Ludii Forum (https://ludii.games/forums)
+-- Forum: Problems (https://ludii.games/forums/forumdisplay.php?fid=5)
+--- Forum: Ludii Player Problems (https://ludii.games/forums/forumdisplay.php?fid=6)
+--- Thread: Strange macro error (/showthread.php?tid=436)



Strange macro error - slimy_asparagus - 02-14-2021

In the attached file the code

Code:
("PieceColour" "Black" "#2c2d28" P2)
generates the following error

Code:
Define has more than 1000 expansions '(piece Colour #3 ...'.
It does not happen if I replace macro with its expanded contents. It does not seem to depend on the number of times I use the macro, or any of the parameters in the macro. So I am somewhat mystified by it.

The code is:

Code:
// #1 - colour string
// #2 - hex colour
// #3 - side
(define "PieceColour"
    (piece Colour #3 #1 fillColour:(colour #2))
    (piece Rename #3 piece:#1 "disc")
)



RE: Strange macro error - Eric Piette - 02-22-2021

Hi,

The problem comes from the string with the character '#' in it. That character is reserved for the arguments of the define and can not be used for them.

in the attached file I removed it (and put all of them to the first argument) and that works now.
So I advise you to not used that define or to use the other way to define your color in that case without the # character in the arguments.

Regards,
Eric