• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua ERROR: Globalevent -Shop.lua

Erik

hi
Joined
Dec 12, 2008
Messages
260
Reaction score
9
Location
Sweden
Lua Script Error: [GlobalEvent Interface]

data/globalevents/scripts/shop.lua: onThink
data/globalevents/scripts/shop.lua:8: attempt to index global 'db' (a nil value)

stack traceback:
[C]: in function '__index'

data/globalevents/scripts/shop.lua:8: in function <data/globalevents/scripts/shop.lua:7>

[Error - GlobalEvents::think] Failed to execute event: shop


Line 8 : local result_plr = db.getResult("SELECT * FROM z_ots_comunication WHERE `type` = 'login';")

TFS 0.2.10

Someone can help :)?
 
TFS 0.2 is missing this:

Lua:
function db.getResult(query)
	if(type(query) ~= 'string') then
		return nil
	end

	local ret = Result:new()
	ret:create(query)
	return ret
end

Try to add it to the bottom of data/global.lua and see if that works.
 
Last edited:
Just remove it for now, its only the shop system. Weird thought, it uses OpenTibia DLL Pack (v1.5) which contains libluajitsql_mysql.dll. I hope queries to database will be fixed in lua scripts soon. I think its pretty essential.
 
it uses OpenTibia DLL Pack (v1.5) which contains libluajitsql_mysql.dll
That's LuaSQL, and 0.3's implementation of it is different (it doesn't use LuaSQL but the server's persistent connection to MySQL for executing queries like this).
 
Back
Top