Jump to content

help (table expected, got boolean)


Apo

Recommended Posts

hi , please help me for fixe error

[2016-01-29 13:42:32] ERROR: interior-system\s_interior_admin.lua:6: bad argument #1 to 'pairs' (table expected, got boolean)

please help me for exports

folder house-interiors file house-interiors-inmap have

interiors = {    
    [1] = {  3,   975.26,    -8.64, 1001.14, 90 , "test1"}, 
    [2] = { 11,   501.84,   -67.84,  998.75, 180 , "test2"}, 
    [3] = {  5,   772.43,    -5.19, 1000.72, 0 , "test3" }, 
    [4] = {  2,   2517.2119140625, -1296.705078125, 1076.9359130859, 270, "test4" }, 
    [5] = {  3,   965.16015625, -53.212890625, 1001.1245727539, 90, "test5" }, 
    [6] = {  3,   834.61,     7.54, 1004.18, 90 , "test6" }, 
} 
  
function getInteriorsList() 
return interiors 
end 

folder interior-system file s_interior_admin have

function getInteriorID( thePlayer, commandName ) 
    local c = 0 
    local interior = getElementInterior( thePlayer ) 
    local x, y, z = getElementPosition( thePlayer ) 
    local interiors = exports["house-interiors"].getInteriorsList()  
    for k, v in pairs( interiors ) do 
        if interior == v[1] and getDistanceBetweenPoints3D( x, y, z, v[2], v[3], v[4] ) < 10 then 
            outputChatBox( "Interior ID: " .. k, thePlayer ) 
            c = c + 1 
        end 
    end 
    if c == 0 then 
        outputChatBox( "Interior ID not found.", thePlayer ) 
    end 
end 
addCommandHandler( "getinteriorid", getInteriorID ) 

Edited by Guest
Link to comment

Bro. The other thread you made we told you:

exports["house-interiors"].getInteriorsList()

Is NOT returning a table.

and tosfera is right, to call another resource's function you need the colon not period, like so:

exports["house-interiors"]:getInteriorsList()

Check to make sure getInteriorsList is being exported in the meta.xml of the house-interiors resource.

Do not create another thread for the same problem please.

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