To use a scripting language or not to use a scripting language?

Chris Wright via Digitalmars-d digitalmars-d at puremagic.com
Fri Jan 6 01:18:16 PST 2017


There are a couple reasons to make a scripting language.

One is so you can treat code as data. If you have an asset pipeline, it 
might be handy to treat scripts as assets. If you have a scene editor, 
it's straightforward to plug in another type of asset instead of a weird 
link to a named function that has to be registered and tracked 
separately. Scripts are often tightly tied to levels, and by making them 
normal assets, you ensure that they can be versioned with their levels.

Another is speed of development. Scripting languages tend to be easier to 
use (with a greater runtime cost in many cases). You don't have to stop 
the game, recompile everything, and restart -- sometimes you can just 
reload it on the fly.

Another is to limit what you can do. Maybe you don't fully trust the 
people writing the scripts and want to prevent them from freely reading 
from the filesystem, or opening sockets, or whatever. There are a 
thousand and one ways to mess up any program, but you can close off a 
bunch of them by offering a limited scripting interface.

Anyway. Lua would be a reasonable option to integrate. I don't think 
there's a high-level wrapper for it in D. There's also DMDScript, which 
didn't compile on my system last time I tried. Honorable mention to MiniD 
for those old enough to remember it.


More information about the Digitalmars-d mailing list