| 04-25-2006, 10:51 AM | #1 |
Since I started using tables instead of handle vars, I have a bit of a problem. I only have a ClearTable(string) which does this: JASS:function ClearTable takes string table returns nothing call FlushStoredMission(Cache(),table) endfunction Thing is, what if I want to clear a certain variable inside a table? which function I should make? I remember I made this for the handle vars but it acts kind of differently for tables. I want to be able to clear a certain var from a table. For example: JASS:local string s = GetAttachmentTable(s, unit) call SetTableBoolean(s, "b", true) Then I want only to clear the "b" value, and not the entire table. Can anyone help me with this? Thanks. |
| 04-25-2006, 11:33 AM | #2 |
I've never looked at this implementation of tables but what you want to accomplish translates to JASS:FlushStoredBoolean(Cache(), s, "b") Vexorian might also have implemented an auto-flush on default value behavior, in which case you'd simply use JASS:SetTableBoolean(s, "b", false) But that's pure speculation, as already mentioned I've never checked the implementation. |
| 04-25-2006, 11:58 AM | #3 |
hmm now that i'm looking at it; JASS:function SetTableObject takes string table, string field, handle val returns nothing local gamecache g=Cache() if (val==null) then call FlushStoredInteger(g,table,field) else call StoreInteger(g,table,field,H2I(val)) endif set g=null endfunction It seems that if the value is null than it flushes the certain var so if I use JASS:call SetTableObject(s, "u", null) |
| 04-25-2006, 12:05 PM | #4 |
Yes, correct. That's what I meant with "auto-flush on default value". For booleans it would be false, for strings either null or "" and for numeric types 0. |
| 04-25-2006, 12:34 PM | #5 |
Thanks mate. |
