iPrestege Posted April 30, 2013 Posted April 30, 2013 Hello,Guys , Will am working on my fucking script but i have problem here : local table = {} addEventHandler("onClientResourceStart",resourceRoot, function () local node = xmlLoadFile ( "skins.xml" ) if ( node ) then local skins = 0 while ( xmlFindChild ( node, "skin", skins ) ) do local skin = xmlFindChild ( node, "skin", skins ) skins = skins + 1 local name = xmlNodeGetAttribute ( skin, "name" ) local id = xmlNodeGetAttribute ( skin, "id" ) table.insert( table, {name,id}) end xmlUnloadFile ( node ) end for k, v in ipairs ( table ) do local row = guiGridListAddRow(GUIEditor.gridlist[1]) guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, tostring(v[2]), false, false) guiGridListSetItemText(GUIEditor.gridlist[1], row, 2, tostring(v[1]), false, false) guiGridListSetItemColor(GUIEditor.gridlist[1], row, 1, 255, 0, 0) end end ) Debug : EROR : Test/Client.lua:84: attempt to call field 'insert' ( nil value ) . Regards Prestege .
Cadu12 Posted April 30, 2013 Posted April 30, 2013 Do not make new table function. Change it name the variable ("table"). Ingame nick: Cadu12
iPrestege Posted April 30, 2013 Author Posted April 30, 2013 Do not make new table function. Change it name the variable ("table"). Hmm.. Which line you are talking about i don't understand you sorry and i change the variable but nothing .
Cadu12 Posted April 30, 2013 Posted April 30, 2013 "local table" means table library is removed it. Change it the name. Ingame nick: Cadu12
iPrestege Posted April 30, 2013 Author Posted April 30, 2013 You can see here i change it but the same error : local MySkins = {} addEventHandler("onClientResourceStart",resourceRoot, function () local node = xmlLoadFile ( "skins.xml" ) if ( node ) then local skins = 0 while ( xmlFindChild ( node, "skin", skins ) ) do local skin = xmlFindChild ( node, "skin", skins ) skins = skins + 1 local name = xmlNodeGetAttribute ( skin, "name" ) local id = xmlNodeGetAttribute ( skin, "id" ) table.insert( MySkins, { name,id } ) end xmlUnloadFile ( node ) end for k, v in ipairs ( MySkins ) do local row = guiGridListAddRow(GUIEditor.gridlist[1]) guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, tostring(v[2]), false, false) guiGridListSetItemText(GUIEditor.gridlist[1], row, 2, tostring(v[1]), false, false) guiGridListSetItemColor(GUIEditor.gridlist[1], row, 1, 255, 0, 0) end end )
Cadu12 Posted April 30, 2013 Posted April 30, 2013 Then I guess you made new global called "table" from other file. Check it. Ingame nick: Cadu12
iPrestege Posted April 30, 2013 Author Posted April 30, 2013 Oh, You are right , Thank you Work's great!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now