Jump to content

Attempt To Index Local 'result' a nil value - HELP!


Recommended Posts

I Get That Error

Script:

function resStart() 
    local result = mysql:query_fetch_assoc("SELECT value FROM settings WHERE name='globalsupplies' LIMIT 1") 
    globalSupplies = tonumber(result["value"]) 
  
end 
addEventHandler("onResourceStart", getResourceRootElement(), resStart) 

Link to comment

try

function resStart() 
    local result = mysql:query_fetch_assoc("SELECT value FROM settings WHERE name='globalsupplies' LIMIT 1") 
    globalSupplies = tonumber(result[1]["value"]) 
  
end 
addEventHandler("onResourceStart",resourceRoot, resStart) 

Link to comment
try
function resStart() 
    local result = mysql:query_fetch_assoc("SELECT value FROM settings WHERE name='globalsupplies' LIMIT 1") 
    globalSupplies = tonumber(result[1]["value"]) 
  
end 
addEventHandler("onResourceStart",resourceRoot, resStart) 

Nope

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...