Cant use vml array in lua

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

Moderators: Forum Moderators, Developers

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

Cant use vml array in lua

Post by Smok » June 14th, 2016, 7:05 pm

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: 994
Joined: February 10th, 2013, 2:25 pm

Re: Cant use vml array in lua

Post by gfgtdf » June 14th, 2016, 7:29 pm

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