Alright, so when I was a really nooby lua scripter, I didn't really understand how anything worked. My friend whom was really experienced in web development, and lua made a script for me that basically is a global chat system (except I didn't use sockets because I refused to do that (
/index.php/topic,5516)).
I recently remade it because I've actually much better than him now, and when I was remaking it, I used some of his code as I didn't understand what it did (#), and recently it came into question on what it still does because I did not know still. Though, because this term is still new to me, I'd like some clarification on this seeing as I may still not understand it fully.
local Get_LastID_Query = MPGCserver:query("SELECT * FROM chat ORDER BY id DESC LIMIT 1")
Get_LastID_Query:start()
function Get_LastID_Query:onSuccess( data )
if #data > 0 then
lastID = data[#data].id
end
From my
extensive knowledge of mysql, I can see that it requests the highest last number from the database. Then the function gets the data, but my question is, how does this work, what does it mean:
if #data > 0 then
lastID = data[#data].id
end
From my idea on it, it basically counts the
data in the if statement, then for the lastID, it does well, I do not know, that's really where my question is at this time.