Jump to content
×
×
  • Create New...
  • 0

Problem tonumber


Minion

Question

local vnumtest = item.get_vnum()
local rowvnum = tonumber(vnumtest-53000)
local test_query = game.mysql_query("SELECT pet"..rowvnum.." from player.pet_level WHERE pid="..pc.get_player_id().." LIMIT 1")
local coins_now = tonumber(test_query.pet"..rowvnum..")
pet_info_map = {
[53001]     = { 34001, "Lv."..coins_now.." Ph" ,0},


No work... Help plz
Link to comment
  • Answers 3
  • Created
  • Last Reply

Top Posters For This Question

Popular Days

Top Posters For This Question

3 answers to this question

Recommended Posts

  • 0

maybe like that?

local test_query = game.mysql_query("SELECT pet"..rowvnum.." from player.pet_level WHERE pid="..pc.get_player_id().." LIMIT 1")[1][1]

remember the result of a mysql query is an array

Link to comment
  • 0
local vnumtest = item.get_vnum()
local rowvnum = tonumber(vnumtest-53000)
local test_query = game.mysql_query("SELECT pet1 from player.pet_level WHERE pid="..pc.get_player_id().." LIMIT 1")
local coins_now = tonumber(test_query.pet1)
pet_info_map = {
[53001]     = { 34001, "Lv."..coins_now.." Ph" ,0},
 
When you install pet1 all works. As soon as I pet1 on rownum, then everything stops working
 
pet1 - work
pet"..rownum.." - no work
 
Sorry my bad English
 
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


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.