Can we sandbox GDScript ?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Linkpy
:warning: Old Version Published before Godot 3 was released.


I’m doing a rhythm game, and I want to implement an event-driven storyboard system using scripts that track creators can do.

But, I want these script to access only node in the background (because I want to let the user set the darkness of the background).

Is there a way to do it ? Or need I do use another script system (Lua, etc) ?
Thanks !

:bust_in_silhouette: Reply From: rgrams

I don’t quite understand what you want to do, but it sounds like you could use a Group and call_group() to access only the nodes you want.

I want to allow user to create script within the game, and avoiding it to modify the game’s node : Sandbox (software development) - Wikipedia :

A sandbox is a testing environment that isolates untested code changes and outright experimentation from the production environment or repository”

“By further analogy, the term “sandbox” can also be applied in computing and networking to other temporary or indefinite isolation areas, such as security sandboxes […] that prevent incoming data from affecting a “live” system

What I want is to isolate a script, created by the user, and giving in only what I want. So, removing the get_tree() and other functions like this.

Linkpy | 2016-08-25 20:39

Ah, I see. Sorry I didn’t understand and I don’t know the answer either. I’ve seen a couple other people talk about something like that though. Depending on how much you know already you might be better off with a general google search, or looking up how other languages do sandboxing, or maybe asking Juan directly, if you’re just not sure about GDScript.

rgrams | 2016-08-26 01:44