can display list take in unknown variables?

suppose my display list contains drawing code with unknown variables called x,y. The values are x, y are assigned in a function just before calling the display list. Will the display list load these values and draw accordingly?

The display list will contain whatever is passed to OpenGL (with a few exceptions, some functions can’t be stored) when it’s created. So if the content of the display list depends on one or more variables, the display list will contain the geometry with the variables from the time the display list was created.