Allow plugins to access the command line environment

I recently suggested adding a new global variable to the command line, and it was shot down, in part because this can be accomplished with extensions. The problem, however, is that anything you want to access via the command bar has to be saved in _G, which in my opinion looks ugly and hacky.

Giving plugins the power to access the command line’s environment (or perhaps share it) would be quite useful.

  • Yea
  • Nay

0 voters

1 Like

I don’t think this is a good idea. If we allowed plugins to access the command bar it would be a mess: how would we handle conflicts between plugins trying to all modify the command bar environment? What about security (plugins have fewer privileges than command bar so it would be a security risk)? There are a lot of open questions like this which would be hard to resolve.

Most of the problems in the command bar stem from lack of proper Intellesense, not lack of extensibility. For example, typing game:GetService(" could show a list of class names which can be selected from:

blob.png

The editor could also automatically insert the second quote when the first quote is typed (screencap from Sublime Text):

GIF.gif

These two changes would make typing code in the command bar far less tedious.

5 Likes

Can’t blame a feature for bad plugin design.

As long as you don’t run a custom function in the commandline, you’re fine.
Of course they could rewrite print() to secretly run a context hook, but eh, details…
(A malicious plugin is already bad on its own, having commandline access isn’t that big of a deal)

It would be nice if the commandline and plugins shared the same _G/shared again.
Since the whole “each context their own tables” using the commandline is a bit worse.
(either that, or the “plugins get their own context, different from commandline”, I forgot)
Having access to the same _G/shared would surely make it a lot easier to use stuff.
(you’re normally gonna call a random function in _G/shared in the commandline, right?)

1 Like