Skip to content
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

Ternary Operators #36

Closed
ngrealish opened this issue Sep 20, 2023 · 3 comments · Fixed by #47
Closed

Ternary Operators #36

ngrealish opened this issue Sep 20, 2023 · 3 comments · Fixed by #47

Comments

@ngrealish
Copy link

In C# / Unity, to write a Ternary operator, syntax is

variable = (condition) ? true : false;

Where in GDScript, it's

variable = true if (condition) else false

Here is an example from one of my projects:

C#: max_pos.x = (booster_offset.x > max_pos.x) ? booster_offset.x : max_pos.x
GDScript: max_pos.x = booster_offset.x if (booster_offset.x > max_pos.x) else max_pos.x

If there's a way to add this to the conversion or train gpt for this, that'd be great for someone like me who uses ternary operators quite often.

@FlooferLand
Copy link
Contributor

I've made a branch, but I can't test it out because of OpenAI's API rate limits.
Feel free to try it out at FlooferLand/unifree/tree/ternary and provide any feedback!

@bshikin
Copy link
Contributor

bshikin commented Sep 21, 2023

@FlooferLand I think we have a more comprehensive solution with the RAG LLM approach (#47)

@ngrealish once the PR above is merged ternary operator would be translated correctly.

PLEASE FILE TRANSLATION REQUESTS
We now have a framework to accommodate them.

@bshikin bshikin linked a pull request Sep 21, 2023 that will close this issue
@bshikin
Copy link
Contributor

bshikin commented Sep 21, 2023

Fix has been merged into master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants