Jump to content

[HELP] Table's empty after inserting some strings


Kazafka

Recommended Posts

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

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