-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Semver in Dependency Constants #419
Conversation
I assume major: 1 ? |
v1.12.1-rc would be mj: -1 since I did not bother writing an semver parser because |
the leading
sadly cause we really need more playtesters x_x |
I could just terminate on a |
Yeah that's fine. Was just wondering whether it would be a |
Ignores now anything after a |
genuinely surprised any kind of table stuff works in #ifs? |
Conditions for #if are normal squirrel expressions, they just need to be able to be evaluated at compile time (ie be constant). Even stuff like this works |
…er into dependency-semver
This comment was marked as outdated.
This comment was marked as outdated.
This reverts commit a4084a4.
This comment was marked as outdated.
This comment was marked as outdated.
fixed again. |
Small request: Make the version available as a string as well :) |
you can now do checks like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very good i like so hot and sexy mmhmmm nice code yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested the pr; works well except it crashed once ( used the last ci build btw )
used a script command to test this : script printt(HAS_DEP_TEST_2.version, "major:",HAS_DEP_TEST_2.major,"minor:",HAS_DEP_TEST_2.major,"patch:",HAS_DEP_TEST_2.patch)
with dep_test_2
1.2.3 major: 1 minor: 1 patch: 3
without dep_test_2
[NORTHSTAR] [info] sq_compilebuffer returned SQRESULT_NULL
[NORTHSTAR] [info] sq_call returned SQRESULT_ERROR
with rc for patch
1.2.3-rc major: 1 minor: 1 patch: 3
another note it also works by just using #if DEP
:)
It looks like the game crashes when accessing a dependency constant table and then recompiling scripts |
@uniboi is this still going to be worked on? Or has the crashing discouraged you? |
I think it might just be a refcount issue, I haven't tested any further though. |
@uniboi heads-up that there are merge conflicts here ^^ |
fixed in #685 |
If a mod for a dependency constant is loaded, this will create a sqvm constant that's a SQTable holding the dependency's
major
,minor
andpatch
version as integer. All other subversions are omitted.If a dependency is not loaded, the constant will be
0
instead.This does not break compatability with old versions since a table is a truthy value like
1
, as it is now.This allows modders to compile code for ranges of mod versions.
For example:
Invalid version numbers are represented as
-1
."1.2.test"
major: 1
minor: 2
patch: -1
"1."
major: 1
minor: -1
patch: -1
"heheheha"
major: -1
minor: -1
patch: -1
etc.