thanks buddy can work will try that right now,
but i have one more thing for u to help me out :D
how can i find the date 5 days before today, i know this sounds funny bt here is wat i wanna do
i wanna keep logs of all last 4 days share by the user, so on every 5th day, the 5 days earlier share shud be deleted.
so i wud get the date of today with os.date("%D") bt how do i find the date 5 days prior from today.
thanks satya
This is another common problem you are facing. Let's see the code from plop:
-- The following 2 functions are
-- Copyright (c) 2005, plop
-- All rights reserved.
JulianDate = function(tTime)
tTime = tTime or os.date("*t")
return os.time({year = tTime.year, month = tTime.month, day = tTime.day,
hour = tTime.hour, min = tTime.min, sec = tTime.sec}
)
end
JulianDiff = function(iThen, iNow)
return os.difftime( (iNow or JulianDate()) , iThen)
end
-- End of plop's code
Explanation is here (http://www.lua.org/pil/22.1.html).
MUTOR with ur xplanation i understood lil bit, bt again i m not gettin wat to do and how. it will be better if u can xplain me with an example pls.
i think for u to explain in a better way i will show u wat i m tryin to do.
sHare={}
LogShare = function(user,data)
nIK=user.sNick:lower()
if sHare[os.date("%D")] then
if sHare[os.date("%D")][nIK] then
table.insert (sHare[os.date("%D")][nIK],data)
SaveRecords()
else
sHare[os.date("%D")][nIK]={}
table.insert (sHare[os.date("%D")][nIK],data)
SaveRecords()
end
else
sHare[os.date("%D")]={}
sHare[os.date("%D")][nIK]={}
table.insert (sHare[os.date("%D")][nIK],data)
SaveRecords()
end
return
end
And heres how to table looks like:
sHare = {
["01/03/09"] = {
["pharoh"] = {
[1] = "yes man",
},
["allan"] = {
[1] = "bedtime stories",
[2] = "red line",
},
["cody"] = {
[1] = "LOST Se 4",
},
},
}
So here as u see dat i m storing the data in the table according to date as indices as said by mutor. Now the reason for this is after 5 days i want the records of the date 5 days prior to today can be easily deleted. which i want to do wen the script starts. For which i want to get a Date wich will be 5 days prior to todays date.
i don know bt i think i m sounding stupid, bt it will be great if u can xplain with a function wich takes arg as date and returns date wich is 5 days prior to arg date.
and in ur post u said
QuoteThis would mean you need to parse that date before you make comparisons.
wat did u meant with dat can u xplain me pls.
it will be really great if u guys can xplain with examples pls
thanks satya
Hey wats happenin? Where are the mods is there anyone to help pls. :(