Cant use vml array in lua

Discussion of Lua and LuaWML support, development, and ideas.

Moderator: Forum Moderators

Post Reply
Smok
Posts: 53
Joined: June 14th, 2016, 11:52 am

Cant use vml array in lua

Post by Smok »

I have variable like this.

Code: Select all

[set_variables]
			name = themes.elves
			[value]
				code = Gg
				gold = 10
			[/value]
			[value]
				code = Gg
				gold = 20
			[/value]
		[/set_variables]
and lua code:

Code: Select all

local t = wesnoth.get_variable("themes.elves")
wesnoth.message(string.format(t[1].gold))
Should show 20, but error happens - nil value. Somehow wesnoth.message(string.format(t.gold)) shows 10. How i can use this wml array in lua?
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: Cant use vml array in lua

Post by gfgtdf »

There is a doceuemntation about how wml talbes are encoded in lua in the Luawml wiki page.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
Post Reply