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

[FeatureRequest] more user friendly lua parsing/execution #89

Closed
Bia10 opened this issue Sep 19, 2021 · 0 comments
Closed

[FeatureRequest] more user friendly lua parsing/execution #89

Bia10 opened this issue Sep 19, 2021 · 0 comments

Comments

@Bia10
Copy link
Contributor

Bia10 commented Sep 19, 2021

Currently the way that Lua is parsed and executes is kind of confusing:

public void ClickOnTrainButton()
{
   LuaDoString("LoadAddOn\"Blizzard_TrainerUI\"f=ClassTrainerTrainButton;f.e=0;if f:GetScript\"OnUpdate\"then f:SetScript(\"OnUpdate\",nil)else f:SetScript(\"OnUpdate\",function(f,a)f.e=f.e+a;if f.e>.01 then f.e=0;f:Click()end end)end");
}
  • Annoyingly long lines, not suitable for diff comparison
  • Stripping of whitespace makes it hardly readable
  • Need to escape strings from Lua code

Why can't we have it like this?

public void ClickOnTrainButton()
{
	LuaDoString(@"
	LoadAddOn"Blizzard_TrainerUI"
	local trainButton = ClassTrainerTrainButton
	trainButton.e = 0

	if trainButton:GetScript"OnUpdate" then
	   trainButton:SetScript("OnUpdate", nil)
	else
	     trainButton:SetScript("OnUpdate", function(trainButton, e)
	     trainButton.e = trainButton.e + e
		 if trainButton.e > .01 then
		    trainButton.e = 0
	            trainButton:Click()
		 end
	     end)
	end")
}
@Jnnshschl Jnnshschl closed this as not planned Won't fix, can't repro, duplicate, stale Jan 14, 2024
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

No branches or pull requests

2 participants