Forum > Coding >

Is it possible to write to a C# value while using SendLuaScript with the WeAreDevs API?

Posts: 6

Threads: 2

Joined: Mar, 2020

Reputation: 0

Posted

Basically, something like

if condition == true then
    ToCS("thisVar = 43;")
else
    ToCS("thisVar = thisVar - 1;")
end

.

Does something like this exist already, or is there some sort of work-around? Anything that helps me achieve what I want?

  • 0

Shojmorez

Posts: 0

Threads: 0

Joined: ?

Reputation:

Replied

What do you mean write to a c# value? Like assign a value to a variable?

  • 0

Posts: 6

Threads: 2

Joined: Mar, 2020

Reputation: 0

Replied

@63568 Yes. I want my C# code to act accordingly to my Lua code in real-time.

  • 0

Added

@63568 I said I wanted to overwrite a C# variable with data influenced by my Lua findings.

  • 0

Shojmorez

Posts: 673

Threads: 30

Joined: Aug, 2020

Reputation: 6

Replied

@Shojmorez you could do a Lua parser or a Lua lexer.

 

I use a parser for my Monaco Editor, Default Monaco does not have a parser.

https://streamable.com/kkd5jr

  • 0

Posts: 6

Threads: 2

Joined: Mar, 2020

Reputation: 0

Replied

@MaximusExploit

Cool, but may you elaborate? How would I get some thing like that to work, and what good would it do along the way?

Edit: Actually, I'm not sure if you know what I'm talking about. I want to be able to edit my variables declared in my C# code with the findings from my Lua code.

  • 0

Shojmorez

Posts: 0

Threads: 0

Joined: ?

Reputation:

Replied

@Shojmorez So you want to like....for example get the player position using lua and store the player position in a c# variable? That's a lot more complicated to do (especially in c#) than you think.

  • 0

Posts: 6

Threads: 2

Joined: Mar, 2020

Reputation: 0

Replied

@63568 So you're saying it's possible?
Maybe I use a constantly updating pastebin or something like that and read off of that?

  • 0

Shojmorez

Posts: 673

Threads: 30

Joined: Aug, 2020

Reputation: 6

Replied

@Shojmorez Yes it's possible, You will still use a parser or lexer. Pastebin won't solve your problem.

 

Example of a lexer:

i = 1;
[
    {
         value = "i",
         line = 1,
         column = 1,
         type = "identifier"
    },
    {
         value = "=",
         line = 1,
         column = 1,
         type = "eq"
    },
    {
         value = 1,
         line = 1,
         column = 5,
         type = "double"
    }
]

  • 0

Posts: 0

Threads: 0

Joined: ?

Reputation:

Replied

@MaximusExploit This is just my intepretation of his question but i think, i think, he means he wants to get a value from Roblox.

  • 0

Posts: 673

Threads: 30

Joined: Aug, 2020

Reputation: 6

Replied

@Shojmorez Your question is very unclear. If you want to interact with C# via Lua. You could embed a compiler and register it as a closure. This could lead to vulnerabilities so I wouldn't recommend doing it.

compile(...)
  • 0

Users viewing this thread:

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