trevordevore / levure

Application development framework for LiveCode
MIT License
32 stars 14 forks source link

`_useFileWithThisEngine` evaluates operators in the opposite way to expectations #191

Closed montegoulding closed 1 year ago

montegoulding commented 1 year ago

The preferences helper has the following engine version for loading the external on macos:

engine version: "<9.0"

This should mean if the engine version is less than 9.0 the external should be loaded. However, the operator is evaluated as:

return tVersion < tEngineVersion

So we get return 9.0 < 9.6 or some such engine version which evaluates to true.

The switch statement should be:

switch tOperator
    case "<"
      return tEngineVersion < tVersion

    case ">"
      return tEngineVersion >  tVersion

    case "<="
        return tEngineVersion  <= tVersion 

    case ">="
      return tEngineVersion >= tVersion

    default
      return false
  end switch