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 |
ScureX
left a comment
There was a problem hiding this comment.
very good i like so hot and sexy mmhmmm nice code yes
There was a problem hiding this comment.
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: 3without dep_test_2
[NORTHSTAR] [info] sq_compilebuffer returned SQRESULT_NULL
[NORTHSTAR] [info] sq_call returned SQRESULT_ERRORwith rc for patch
1.2.3-rc major: 1 minor: 1 patch: 3another 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,minorandpatchversion as integer. All other subversions are omitted.If a dependency is not loaded, the constant will be
0instead.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.