How to compare string from table from function with string?
Posted: Fri Aug 27, 2010 4:17 pm
I could propably figure this one out myself too, but since I have participated in game making contest and time is starting to run out (less than 4 days for deadline) i better continue programming from elsewhere and let you guys tell me how to do this.
Problem is (example code):
Function comparestrings(string)
if table1.text = string then something
Endfunction
Table1 = { text = "currenttext" }
Table2 = { text = "new text" }
comparestring(table2.text)
I thought this would work so, that it compares "currenttext" with "new text". However, i dont know how Hollywood works in this case, but it gives me error about "Cant compare string to number".
When i used
DebugPrint(table1.text, string)
right before the line "If table1.text=string)" it shows that table1.text contains "currenttext" and string contains "new text".
Yet despite that, it complains it cant compare string with number?
What am i doing wrong here, what am i not understanding?
Problem is (example code):
Function comparestrings(string)
if table1.text = string then something
Endfunction
Table1 = { text = "currenttext" }
Table2 = { text = "new text" }
comparestring(table2.text)
I thought this would work so, that it compares "currenttext" with "new text". However, i dont know how Hollywood works in this case, but it gives me error about "Cant compare string to number".
When i used
DebugPrint(table1.text, string)
right before the line "If table1.text=string)" it shows that table1.text contains "currenttext" and string contains "new text".
Yet despite that, it complains it cant compare string with number?
What am i doing wrong here, what am i not understanding?