Kazafka Posted January 4, 2020 Share Posted January 4, 2020 Ok, t h i s i s i n s a n e. I don't know WHAT IS WRONG, that Lua thinks, TABLE IS EMPTY!!! Code for creating table: enableGarageFunctions = {} Right? Then XML code: <list> <toggles> <toggle garage="Y"/> </toggles> </list> Lua code to read this: local xml = xmlLoadFile("police_settings.xml") -- if xml then local togglesBranch = xmlFindChild(xml, "toggles", 0) -- local togglesTable = xmlNodeGetChildren(togglesBranch) -- for i, node in ipairs(togglesTable) do enableGarageFunctions[i] = xmlNodeGetAttribute(node, "garage") end -- xmlUnloadFile(xml) end And for Lua, actually, THIS table is e m p t y. Because: for k, v in ipairs(enableGarageFunctions) do if(string.match("Y", v)) then --some code end end THIS RETURNS F A L S E. How in the world? Even in console it outputs, that the table isn't empty. CODE: outputConsole(inspect(enableGarageFunctions)) Output in console: {"Y"} h o w i n t h e w o r l d Link to comment
Discord Moderators Zango Posted January 5, 2020 Discord Moderators Share Posted January 5, 2020 There is nothing wrong in that, so the error is elsewhere in your script. Post the rest, if it's too big you can use pastebin.com Link to comment
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