Odd Error.... Hmm.

So I’m saving my players data to a MySQL server, however after the data is saved, and the player reconnects to try and load their data, I get this error:
[lua]
includes/extensions/string.lua:147: bad argument #1 to ‘find’ (string expected, got nil)
[/lua]
I honestly have no idea where to start…
Thanks for any help you can offer.


(User was banned for this post ("Undescriptive thread title" - mahalis))

It would help if you give us the code where the player loads the data.

Alright… it’s in multiple places however, and when I truncate my tables while the players are connected, it allows them to create new data… I’m sure it’s the way my MySQL is structured… I’m not looking for an exact answer, just maybe a general one.

[editline]09:21PM[/editline]

By the way, that error is from a Garrysmod default Lua file, not mine.

Just the parts where you’re using functions from the string library. That’s your problem, is you’re using a string function with a bad input. My guess is string.Explode.

Hmm… I’ll look, thanks. It’s not a Lua error, it’s my SQL structure.

:frowning: This is frustrating the crap out of me.

It’s an error with your usage of string.Replace, not sql.

string.Replace(str, tofind, toreplace)

str is nil wherever you called it in the code.

Hey Kogitsune thanks.

[lua]string.Replace(string.Replace(string.Replace(text, “\\”, “\”), ‘\"’, ‘"’), “\’”, “’”);[/lua]

That’s the only Replace method in my script that could be relevant to what I’m doing… If you have any ideas, their much obliged.

Anyone got ideas?


(User was banned for this post ("Bump" - mahalis))