A system comprising: a script execution module comprising a compiler that is configured to compile scripts, represented in a base scripting language, into virtual-machine programs, wherein the scripts comprise instructions that reference device properties, a virtual machine that is configured to execute virtual-machine programs, a script registry, and a script manager that is configured to store scripts in the script registry, retrieve scripts from the script registry, and load scripts into the compiler, wherein the compiler automatically compiles the scripts into the virtual-machine programs as they are loaded into the virtual machine; 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, a device manager comprising one or more drivers, wherein each of the one or more drivers is configured to communicate 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 wherein the device manager is configured to, when executed by the at least one hardware processor, map device properties referenced in the virtual-machine programs to device properties used by the one or more drivers, according to a mapping. a script execution module comprising a compiler that is configured to compile scripts, represented in a base scripting language, into virtual-machine programs, wherein the scripts comprise instructions that reference device properties, a virtual machine that is configured to execute virtual-machine programs, a script registry, and a script manager that is configured to store scripts in the script registry, retrieve scripts from the script registry, and load scripts into the compiler, wherein the compiler automatically compiles the scripts into the virtual-machine programs as they are loaded into the virtual machine; and a compiler that is configured to compile scripts, represented in a base scripting language, into virtual-machine programs, wherein the scripts comprise instructions that reference device properties, a virtual machine that is configured to execute virtual-machine programs, a script registry, and a script manager that is configured to store scripts in the script registry, retrieve scripts from the script registry, and load scripts into the compiler, wherein the compiler automatically compiles the scripts into the virtual-machine programs as they are loaded into the virtual machine; 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, a device manager comprising one or more drivers, wherein each of the one or more drivers is configured to communicate 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 wherein the device manager is configured to, when executed by the at least one hardware processor, map device properties referenced in the virtual-machine programs to device properties used by the one or more drivers, according to a mapping. at least one hardware processor, a device manager comprising one or more drivers, wherein each of the one or more drivers is configured to communicate 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 wherein the device manager is configured to, when executed by the at least one hardware processor, map device properties referenced in the virtual-machine programs to device properties used by the one or more drivers, according to a mapping.