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

Fixes script loading order. #144

Merged
merged 6 commits into from
Nov 11, 2020
Merged

Fixes script loading order. #144

merged 6 commits into from
Nov 11, 2020

Conversation

actboy168
Copy link
Contributor

This change fixes the loading order of inline script and external script.

test.rml:
<script> print(1) </script>
<script src="test.lua"></script>
<script> print(3) </script>

test.lua:
print(2)

Before output:
2
1
3

After output:
1
2
3

I noticed that RCSS has the same problem, but I am not sure if RCSS needs to be modified.

In addition, I added line number information to the inline script, which will make the debug information more friendly.

@mikke89 mikke89 added the Lua Lua binding issues label Nov 6, 2020
@mikke89
Copy link
Owner

mikke89 commented Nov 6, 2020

It's great to see all the contributions coming from you, thanks a lot! :)

I think the main changes make a lot of sense. We might as well do the same for RCSS if it is not too much trouble.

I'm only a bit worried about the ElementDocument API changes though. I know this will break implementations for some users. I'll leave it open a bit for people to chime in.

Source/Core/DocumentHeader.cpp Outdated Show resolved Hide resolved
Source/Core/DocumentHeader.cpp Outdated Show resolved Hide resolved
Source/Core/DocumentHeader.h Outdated Show resolved Hide resolved
Source/Core/DocumentHeader.h Outdated Show resolved Hide resolved
Source/Core/DocumentHeader.h Outdated Show resolved Hide resolved
Source/Core/ElementDocument.cpp Outdated Show resolved Hide resolved
Source/Core/ElementDocument.cpp Outdated Show resolved Hide resolved
Source/Lua/LuaDocument.cpp Outdated Show resolved Hide resolved
Source/Core/DocumentHeader.cpp Outdated Show resolved Hide resolved
{
if (s.line)
{
target.push_back(s);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, makes me think, what is the meaning of line when we merge two headers? It will probably refer to the wrong source file. I think this is only a problem for templates with scripts which is probably unusual. But still, we should probably test this.

Copy link
Contributor Author

@actboy168 actboy168 Nov 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I tested this and there are some bugs in the error message.

@mikke89
Copy link
Owner

mikke89 commented Nov 9, 2020

Thanks a lot! Looks good to me.

I discovered some issues when loading the VisualTests. It looks like this is due to some quirks in how the style sheet cache worked and not related to your code, these changes merely exposed them. I'll merge this as soon as I have a fix for this.

@mikke89 mikke89 merged commit b8ef1e0 into mikke89:master Nov 11, 2020
@mikke89 mikke89 added the enhancement New feature or request label Nov 11, 2020
@mikke89
Copy link
Owner

mikke89 commented Nov 11, 2020

Thanks again!

@actboy168
Copy link
Contributor Author

@mikke89 Can you merge this PR into the data_binding branch? Thank you.

@mikke89
Copy link
Owner

mikke89 commented Nov 19, 2020

Sure, done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Lua Lua binding issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants