| 11-13-2008, 10:10 AM | #1 |
I've read that Table and TimerUtils are all a spell-maker will ever need. How is this so - how exactly is Table used? I went through the Table thread, and I get that it's like an associative array with integer keys, but yeah, I don't exactly understand how it could be used in practice. Is it used to 'attach' data to units/objects via indexing/H2I()? Also, unit-indexing systems. How would Table be a substitute for these? |
| 11-13-2008, 11:02 AM | #2 | |||
Quote:
Quote:
Quote:
|
| 11-13-2008, 11:05 AM | #3 |
Think of Table this way: it's a multi-instanceable 2D array. What's nice is that regular arrays would cause struct instance limit conflicts as well as array value limits. Instead, you can just make as many tables as you want for as many struct instances you want. It can be used to attach data, that is its primary focus, but in order to do that it must be used in conjunction with some other method or system: to attach to a handle you either store the memory address of the handle in question with H2I or use an indexing system to generate array indices for the table. Make sense? |
| 11-13-2008, 01:44 PM | #4 | |||
Quote:
Quote:
Quote:
If Table is simply a step up from using a normal array to index/attach, could I use it in the same way as a normal array, in, for example, an AoE spell that involved a struct 'attached' to all units affected? |
| 11-13-2008, 07:37 PM | #5 |
A table can store three types I believe: Integer, String, and Handle. Integers can be typecasted into struct instances ( a.k.a local data d = tablename[2] ). I'm not really the expert on this, Vexorian is as he made the script and I don't presume to know as much on the topic as him. As for their "limitless", you can instanciate as many of them as you need... I'm not sure on the limit of values you can store in one table but it is probably 8191 as that is the regular array limit. |
| 11-14-2008, 09:02 AM | #6 | |
I think I understand how the storage works. Quote:
|
| 11-14-2008, 10:57 AM | #7 |
You'd have to declare all of those arrays before you compiled the script... like have a bunch of backup arrays all written out in the trigger text, but thats inefficient and a pain to deal with. That's where table comes in. |
