tmysql issues

I’m updating the sql on an old addon and I’m having some issues with the global variable being recognized, I’ve tried updating to tmysql4 and also using the mysqloo tmysql wrapper

Initial file



require("tmysql4")

if (tmysql4) then
     hdb, err = tmysql.initialize( *****, *****, *****, *****, 3306)

end

Then in a separate file which is included in the initial file (example of what I’m doing, the query is fine as it is for the addon)



   hdb:Query( ***, ***, 0, self)


Error


attempt to index global 'hdb' (a nil value) 

Can you provide more context? Is tmysql4 being set? Is hdb:Query() being called in the main chunk (which it shouldn’t be), and if so are you including the other file too early?

(And whenever you post your error message, always include the traceback)

You should be checking for tmysql without the 4.

Tried that already

Client vs server, perhaps?
Trying to make a query before the variable was defined?
Are you sure that tmysql.initialize is actually returning values correctly? (print them)

Yeah I’m starting to think it’s some type of load order issue hence why it can’t be found