Categories > Coding > C# >

Execute script form tabs

TJB13022012

JustSomeGuyThatsHere

Posts: 12

Threads: 4

Joined: Jul, 2022

Reputation: 0

Posted

So if i select the current tab with the avalon text editor (im going to add monaco) and i have some code: WeAreDevsLibrary.SendLuaScript(text);

 

            TabItem selectedTab = tabDynamic.SelectedItem as TabItem;

            TextEditor textEditor = selectedTab.Content as TextEditor;

 

            string text = textEditor.Text;

 

The code of wearedevslibrary.sendluascript(text) then the local variable  gives a error this is the error (cannot use local variable before it is declared) Can someone help me out?

  • 1

Hello there.

marcus__

S.K.I.D

vip

Posts: 444

Threads: 23

Joined: Nov, 2022

Reputation: 29

Replied

put 

WeAreDevsLibrary.SendLuaScript(text);

after you declare text

  • 0

!!!!!marcus__!!!!!#8611

https://cdn.discordapp.com/attachments/1066053366758780978/1078052772567597127/image.png

TJB13022012

JustSomeGuyThatsHere

Posts: 12

Threads: 4

Joined: Jul, 2022

Reputation: 0

Replied

so you mean text = WeAreDevsLibrary.SendLuaScript(); you mean that?

  • 0

Hello there.

marcus__

S.K.I.D

vip

Posts: 444

Threads: 23

Joined: Nov, 2022

Reputation: 29

Replied

@TJB13022012

no lmao


 

            TabItem selectedTab = tabDynamic.SelectedItem as TabItem;

            TextEditor textEditor = selectedTab.Content as TextEditor;

 

            string text = textEditor.Text;

 WeAreDevsLibrary.SendLuaScript(text);
  • 0

!!!!!marcus__!!!!!#8611

https://cdn.discordapp.com/attachments/1066053366758780978/1078052772567597127/image.png

TJB13022012

JustSomeGuyThatsHere

Posts: 12

Threads: 4

Joined: Jul, 2022

Reputation: 0

Replied

I haven't been coding a long time ago. So declare it before or whatever i forgot alot of things.

 

  • 0

Hello there.

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )