TimePath

QC arrays

Jan 13th, 2015
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.51 KB | None | 0 0
  1. float array_get(float index) {
  2.     float size = 2;
  3.     if (index < 0) index += size;
  4.     if (index > size) return 0;
  5.     auto array_get_this;
  6.     array_get_this = array_get + 1 + /* The magic */ ftoi(index);
  7.     float ret;
  8.     ret = array_get_this();
  9.     return ret;
  10. }
  11. float array_0 = 1;
  12. float array_get_0() {
  13.     print("Get0", ftos(array_0));
  14.     return array_0;
  15. }
  16. float array_1 = 2;
  17. float array_get_1() {
  18.     print("Get1", ftos(array_1));
  19.     return array_1;
  20. }
  21.  
  22. void main() {
  23.     array_get(1);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment