Mod API Reference:IsVersionOrHigher: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
'''WL.IsVersionOrHigher''': A function that can be called to determine what version of the | '''WL.IsVersionOrHigher''': A function that can be called to determine what version of the War.app code is running. It takes a single argument, a string, that identifies what version to compare to, and returns a boolean. | ||
This should be used whenever you are using an API feature that says it was added in a specific version to verify that the feature is available. For example, if a feature says it was added in version 5.34, you could check like this: | This should be used whenever you are using an API feature that says it was added in a specific version to verify that the feature is available. For example, if a feature says it was added in version 5.34, you could check like this: | ||
| Line 8: | Line 8: | ||
end | end | ||
Note that the | Note that the War.app server can be assumed to always be running the latest version of War.app code. However, in single-player games, the Server_ hooks are invoked on the client, so you can't assume that you're always in the latest version of the code just because you're in a server hook. | ||
[[Category:Mod API Reference]] | [[Category:Mod API Reference]] | ||
Latest revision as of 02:35, 18 April 2026
WL.IsVersionOrHigher: A function that can be called to determine what version of the War.app code is running. It takes a single argument, a string, that identifies what version to compare to, and returns a boolean.
This should be used whenever you are using an API feature that says it was added in a specific version to verify that the feature is available. For example, if a feature says it was added in version 5.34, you could check like this:
if (not WL.IsVersionOrHigher("5.34")) then
UI.Alert("You must update your app to the latest version to use this mod");
return;
end
Note that the War.app server can be assumed to always be running the latest version of War.app code. However, in single-player games, the Server_ hooks are invoked on the client, so you can't assume that you're always in the latest version of the code just because you're in a server hook.