Hey lads,
Could you help me ? I have this error : "attempt to compare string with number"
Here is my code :
AppList:AddLine( id, ULib.bans[id].admin, string.NiceTime( ULib.bans[id].time ), ULib.bans[id].unban , ULib.bans[id].reason )
you can read the error, it tells you whats wrong. somewhere it compares a string with a number. for example stuff like
is 12 the same as "hello"? that doesnt work obviously
There is no comparison on that line specifically, so wherever that line is added some comparison is being ran on one of the arguments and returning that error.
Check your args and make sure they're all the right datatype.
string.NiceTime look at the wiki.
I can't recall if ULib stores the times for bans as strings or numbers, but if they're stored as strings you're going to run into problems trying to use the string.NiceTime function as it expects a number to be given not a string.
Maybe this would help: tostring.
Could you post the full error with stack trace?
for id, text in SortedPairs( ULib.bans ) do
local time = tostring( ULib.bans[id].time )
---------ajouter une ligne aux bannis-------
AppList:AddLine( id, ULib.bans[id].admin, time ,ULib.bans[id].unban , ULib.bans[id].reason )
------------------déban---------------------------
You're making time a string when it should probably be a number for string.NiceTime in your AddLine call.
Sorry, you need to Log In to post a reply to this thread.