-
-
Notifications
You must be signed in to change notification settings - Fork 29
Add code examples in a separate directory #131
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
base: main
Are you sure you want to change the base?
Conversation
|
Hey @anarchy-chan, thanks for working on this. Overall, I think we could have the examples live inside a single Godot project, which could be the same as the one currently being used for the automated tests (we could rename it from "test" to "example_project" or "examples" or something like that). This way they could be editable / runnable when opening such project with Godot editor. We could even have a scene for opening / editing / running these Lua script examples to make it even more interactive. We can then export this project to web and host it using GitHub Pages for people to try out. What do you think?
It's fine having duplicate information if such information is relevant in both places.
I think a "variants" or "builtin_types" or "builtin_variants" folder with one example file for each Variant type (except for trivial ones like nil, bool, int and float) would be a nice middle ground. Adding an example file for Strings could be nice as well, since when opening the
As mentioned above, I'd say one extra level of directories is fine to group examples in a similar category if it makes sense. For built-in Variant types I think it would make sense. Maybe another folder for LuaScript examples. As for full project examples, I think it's simpler to have everything in a single Godot project instead of creating multiple projects in separate folders. This way people can explore everything by opening a single project in Godot.
It wouldn't hurt, we could run them just to be sure they won't error when people open them in Godot. It's useful to run these things also to make sure examples work in both Lua 5.4 and LuaJIT variants of the addon. |
This sounds good, as long as we also keep the example scripts as well. The interactive project would be better for first time users, while example scripts are easier to reference if you know what you are looking for.
Alright, I agree. The only issue with that is that all places where the information is duplicated have to be kept up to date if anything changes. We could generate the documentation in some way, but that would make things more complicated.
Yeah, that would be better. That way we hopefully wouldn't need any duplication to begin with. But I don't particularly like the three names you suggested because they aren't very intiuitive for new users who haven't used GDScript before. But the meaning could be explained in a readme referencing the directory. Nevertheless, I'd veto for a name like
I'd either put that into I'll have more time to work on this toward the end of next week, but until then I'll most likely be too busy. |
As discussed in #128, here is a rough draft for an examples directory.
There are still a few design decisions that have to be taken care of.
arrays.luafine or do we want it to be inside a biggervariants.luafile? The latter would be fine, as long as we mention that this file contains information about arrays (for people specifically looking for that).It's still far from what I'd like it to be, but what do you think @gilzoide?