Jump to content

Recommended Posts

Hello , i have a little problem..who is pretty nice and help me...

i use this code in my questlib.lua :

out = mysql_query("SELECT * FROM player.mob_proto;", "root", "password")
mob._data = out
mob._idx  = {}
table.foreach(out.vnum,
    function(i,p)
        mob._idx[p]=i
    end
)

setmetatable(mob,{
        __index = function(this,idx)
            local exec = string.gsub(idx,'get_(%.+)','%1')
            if this._data[exec] ~= nil then
                return function(moid)
                    return this._data[exec][this._idx[moid or npc.get_race()]]
                end
            else
                return function() return 0 end
            end
        end
    }
)

ok..but i get a error on that line :

table.foreach(out.vnum,

this error :

locale/en/quest/questlib.lua:1985: bad argument #1 to `?' (table expected, got nil)

Any one know why ?..thank youu !

Link to comment
https://metin2.dev/topic/17362-out-mysql_queryselect-from-playermob_proto/
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.