vendredi 11 mai 2018

LUA: Storing a logical operator in a variable?

I can't find anything about this through Google so I have to ask here. I want to do something like this (very pseudo code):

y = first_value

x={op_1 = >, op_2 = <, c = some_value}

if first_value x.op_1 x.c then
...
end

What that code says to me is that if first_value if greater than x's c value then do something. Now, I know I could set op_1 and op_2 to some value to differentiate between them and then compare values using separate if statements, but I would like to minimize the number of if statements used.

I was just wondering if something like this is possible, maybe even in a different form. Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire