-
-
Notifications
You must be signed in to change notification settings - Fork 491
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 simplesquirrel
library for creating Squirrel API binds
#2792
Conversation
Literally 2 lines...
Incorporates a SuperTux fork of the `simplesquirrel` library. Most important feature of this library in the context of SuperTux is the ability to easily expose functions, classes (which can include properties) and other entries to Squirrel in one or a few lines. Every exposed class, variable and function has been migrated to incorporate this change. As a result, the `scripting/` directory, which included all scripting functions, classes and variables, as well as the API wrapper, has been removed, since it is no longer needed for the new binds. Some scripting functions have been deprecated (currently only via a tag in comment, later to be migrated to docmentation) for several reasons: * Some `get_` and `set_` functions have been deprecated, since a class property has been added and should replace their usage. * Functions with the names `get_pos_x` or `get_pos_y` have been replaced with `get_x` and `get_y` for consistency, thus are now deprecated. This way of creating Squirrel binds would allow for way more flexibility in exposing functions, classes and properties. **TODO:** * Expand usage of simplesquirrel functions, instead of ones in `SquirrelVM`, to reduce code duplication. * Update the scripting API documentation/reference generator to incorporate all changes. Closes SuperTux#2736.
Supersedes #650 |
Update this branch to fix the workflows |
Nvm |
Removes the `SquirrelVM` `HSQUIRRELVM` wrapper and replaces a lot of other usage of raw Squirrel API functions across the source code with `simplesquirrel` equivalents.
It's "|" not "&"!!!!! ;-;
Also adds `m_` prefixes to `Spotlight` member variables. [ci skip]
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.
Great job, guys! This has been a tremendous effort! Other than the few discussion points I posted, this is ready to merge!
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.
Ive been playing around with my scripts on this PR and i happened to notice some issues with errors, namely they dont appear to have any stacktrace attached unlike errors before simplesquirrel. This means that there are no line numbers which makes it particularly annoying to debug my scripts.
Less of an issue and more of a suggestion but can we have functions such as print_stacktrace()
print to the ingame console and not just to the terminal if you open it from the terminal on Linux? Also if camera()
is being removed because it redundant can we also remove whereami()
? Its basically the same as camera()
but for Tux instead.
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.
print_stacktrace()
works great, but theres still no stacktrace when i get an error, meaning my initial issue still isnt resolved. I cant debug my scripts without a stacktrace.
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.
Now this is what the people in the discord would refer to as "peakazoidal". Tested it and it works great.
Incorporates a SuperTux fork of the
simplesquirrel
library. Most important feature of this library in the context of SuperTux is the ability to easily expose functions, classes (which can include properties) and other entries to Squirrel in one or a few lines.Every exposed class, variable and function has been migrated to incorporate this change. As a result, the
scripting/
directory, which included all scripting functions, classes and variables, as well as the API wrapper, has been removed, since it is no longer needed for the new binds.Some scripting functions have been deprecated (currently only via a tag in comment, later to be migrated to docmentation) for several reasons:
get_
andset_
functions have been deprecated, since a class property has been added and should replace their usage.get_pos_x
orget_pos_y
have been replaced withget_x
andget_y
for consistency, thus are now deprecated.This way of creating Squirrel binds would allow for way more flexibility in exposing functions, classes and properties.
Additionally:
camera()
function, as it only printed the camera position, which is already accessible through methods from theCamera
itself.Granito
andGranitoBig
are now scriptable.Documentation
Doxygen scripting documentation is now generated for the entire codebase as well, since scripting classes might be found anywhere.
The
@scripting
tag for classes, functions, constants and variables indicates the item should be added to the scripting documentation. Otherwise, it should be ignored.Added support for the following:
TODO
SquirrelVM
, to reduce code duplication.Closes #2736.