1. A system comprising: a script execution module comprising a compiler that compiles scripts, represented in a base scripting language, into virtual-machine programs, wherein the scripts comprise instructions that reference device properties, a virtual machine that executes virtual-machine programs, and a script manager that stores scripts in a script registry, retrieves scripts from the script registry, and loads scripts into the compiler; and one or more gateways, wherein each of the one or more gateways is communicatively connected to one or more physical devices, and wherein each of the one or more gateways comprises at least one hardware processor, one or more drivers, wherein each of the one or more drivers communicates with at least one of the one or more physical devices using a communication protocol to read, write, or read and write device properties of the physical device, and a device manager that, when executed by the at least one hardware processor, maps device properties referenced in the virtual-machine programs to device properties used by the one or more drivers, according to a mapping.