Code: Select all
If RawGet(receivedcreaturedata, "AI") Then tempcreaturedata.AI = receivedcreaturedata["AI"]
If RawGet(receivedcreaturedata, AI) Then tempcreaturedata.AI = receivedcreaturedata.AI
Code: Select all
DebugPrint(receivedcreaturedata.AI)
However, if i use:
Code: Select all
If RawGet(receivedcreaturedata, "AI") Then debugprint("1")
If RawGet(receivedcreaturedata, AI) Then debugprint("2")
I suppose I am using RawGet wrong way.
Reason for these two different lines is because I am using TILED and I am wanting the lua code it puts out to be usable without any modifications. However, I have been using different system in my code for storing data, which i think its clearer, and hence I did these two different lines depending wether data is coming from my own code, or from TILED.
Data is in following ways.
TILED uses following:
Code: Select all
TABLE = { ["NAME"] = data, ["AI"] = data, ["X"] = data, ["Y"] = data...}Code: Select all
TABLE = { NAME=info, AI=data, X=data, Y=data...}By otherwords, TILEDs data is accessible through TABLE["NAME"] and mine is accessible through, TABLE.NAME
RawGet works fine when getting data from TILED, but how do i make it also work when it comes from my own code.
By otherwords, what is the right usage of RawGet to see if table.name exists? Obviously it is not RawGet(table, name)