When to use lua upvalue mechanism instead of simpler C static variable ? Example, lua 5.4 work-1 math.random : It uses upvalue to store the 128-bits random state. Why not use static uint64_t state[2] ?