How does plugins that has code editors in them work?

Some plugins have “code editors” in them similar to Roblox’s command bar. How do these plugins actually work? Does it take every single word and then some algorithm tries to piece everything together? I’m trying to make something similar myself.

1 Like

Uhm, I don’t 100% get your question, however I’ll try my best. Code editors usually execute code. Simple. Also, in the developer console there is a server side code executor. (only for owners/developers). Honestly, I’m not really a professinal at it, but I believe code editors takes the text from the code text area(wherever that is), then use LogService to add execute it onto the server. Although I’m not 1000%, as I’m not a professinal, that’s the best answer I could probably give about it.

class api refrence: Log Service

No, what I was wondering was how a Roblox plugin can compile text in a textbox and use it to perform an action.

Yes, you can take advantage of LogService by using it. That’s how you do it. It compiles text in a textbox and runs it using LogService. Like I said I’m not experienced with creating anything of the sort. But, I believe they use LogService.MessageOut ( please correct me if I’m wrong like I said ), and then it executes to the server.

Isn’t that used for checking the output?

I doubt that plugins are allowed any functionality that could emulate the command bar, so I’d guess that they’re interpreting Lua, with Lua!

There used to be some plugins/models that did this, but I can’t find them now.

The scale of how plugins work are almost never implemented in luau, and are created in the latest version of lua. Knowing this, I believe the main way to do this is by using a third party file to execute code.

It is exactly like the command bar, check out “In Command”.

Read above, my assumption is they recreated the command bar.

So they imported a software that was written in Lua? :thinking: I don’t really understand

You can write Lua interpreters in Lua. There are a few on Roblox, and an incredulous amount of them if you include backdoors.

1 Like

Could you link me a tutorial on it?

loadstring()

ex:

loadstring(“print(‘hi’)”)() – prints hi

1 Like
I don't think this should be in the #development-discussion category, the category is for discussing things related to the development of Roblox, not for help. (The topic has been moved to #help-and-feedback:scripting-support)

I suspect In Command uses the loadstring (load in Lua ≥ 5.2) function which can run arbitary luau code, which is basically eval in Python/JavaScript.
Something like this

loadstring(arbitary lua code)()

I wanted to add, loadstring returns a function (or nil if the code is invalid), which is why you call what it returns.

Although, for loadstring to work, you must have ServerScriptService.LoadstringEnabled set to true. If the plugin works without that, then its likely they’re using a Lua-in-Lua VM.

The plugin can run without LoadStringEnabled though

But the plugin can run without LoadString being enabled

Hmm, doesn’t seem to print anything though

as NeoInversion said, they’re using a lua bytecode interpreter - basically, they sort of “recreate” lua, using lua.

You can’t go any more basic than that - if you wish to read up on it, search it up yourself.

4 Likes

Might be an issue with the code I sent, my bad

1 Like