c4
c4 copied to clipboard
How to call external functions.
In order to make a script useful for a real world I'd like to write
int main() { int sens1_val; int sens2_val; while(1) { sens1_val = m_sensor.GetDataByValType(1, SENS_VAL_TYPE_TEMP); sens2_val = m_sensor.GetDataByValType(2, SENS_VAL_TYPE_HUM); if ( sens1_val > 30.5 && sens2_val > 60) Out(1, true);
}
}
But how to point the script to external functions (m_sensor.GetDataByValType, Out)?
You are writing in C, not C++
Also this is an extremely limited dialect of C. You might want to add a new opcode to the interpreter to handle this