Jump to content

out = mysql_query("SELECT * FROM player.mob_proto


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
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • 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.