Cant use vml array in lua

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

Moderators: Forum Moderators, Developers

Cant use vml array in lua

Postby 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?
Smok
 
Posts: 49
Joined: June 14th, 2016, 11:52 am

Re: Cant use vml array in lua

Postby 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.
gfgtdf
Developer
 
Posts: 910
Joined: February 10th, 2013, 2:25 pm


Return to Lua Labs

Who is online

Users browsing this forum: No registered users and 2 guests