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

String constants are not converted to lua. #1

Closed
Wyzoom opened this issue Feb 2, 2021 · 2 comments · Fixed by #2
Closed

String constants are not converted to lua. #1

Wyzoom opened this issue Feb 2, 2021 · 2 comments · Fixed by #2
Labels
bug Something isn't working

Comments

@Wyzoom
Copy link

Wyzoom commented Feb 2, 2021

Hi

Consider the following ink code :

CONST a = 1
CONST b = "myString"
CONST c = "true"
CONST d = "false"
-> knot
== knot ==
Hello
a = {a}
b = {b}
c = {c}
d= {d}
->END

As an ink file, it works fine, producing b = myString. When converted to lua, and pretty printed using the inspect.lua library produces the following output :
{ constants = { a = 1, c = true, d = false }, inclusions = {}, lists = {}, tree = { = { = { { divert = "knot" } } }, knot = { _ = { "Hello", "a = #a#", "b = #b#", "c = #c#", "d= #d#", { divert = "END" } } } }, variables = {}, version = { engine = 1, tree = 1 } }
Please note that the constant b = "myString" is not present.

@astrochili astrochili added the bug Something isn't working label Feb 3, 2021
astrochili added a commit that referenced this issue Feb 3, 2021
@astrochili astrochili mentioned this issue Feb 3, 2021
@astrochili
Copy link
Owner

astrochili commented Feb 3, 2021

@Wyzoom Hi! Fixed it :)

Also fixed a bug with boolean constants. Obviously, CONST c = "true" must be converted to c = "true", but not to c = true. If we want to have a boolean constant we need to use CONST c = true

@Wyzoom
Copy link
Author

Wyzoom commented Feb 4, 2021

Great, thank you for the super fast fix! We found another possible bug, variables that are declared before the first know not being converted to the lua table. Will open a new issue in asap.

Cheers
Wyzoom

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants