LightFighter's Lua Lab

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

Moderators: Forum Moderators, Developers

silene
Posts: 1109
Joined: August 28th, 2004, 10:02 pm

Re: LightFighter's Lua Lab

Post by silene » November 27th, 2010, 9:13 am

LightFighter wrote:

Code: Select all

wesnoth.set_variable("cfg.save_in", cfg[wesnoth.get_variable "difficulty"])
Because of the quotes, that will store the value into a variable called "cfg.save_in" (that is, "[cfg]save_in=") instead of the correct place. Also it may be userfriendlier to provide a default variable name:

Code: Select all

wesnoth.set_variable(cfg.save_in or "quantity", cfg[wesnoth.get_variable "difficulty"])

User avatar
bumbadadabum
Developer
Posts: 1005
Joined: March 20th, 2008, 5:54 pm
Location: Netherlands
Contact:

Re: LightFighter's Lua Lab

Post by bumbadadabum » November 27th, 2010, 11:16 am

silene wrote:
LightFighter wrote:

Code: Select all

wesnoth.set_variable("cfg.save_in", cfg[wesnoth.get_variable "difficulty"])
Because of the quotes, that will store the value into a variable called "cfg.save_in" (that is, "[cfg]save_in=") instead of the correct place. Also it may be userfriendlier to provide a default variable name:

Code: Select all

wesnoth.set_variable(cfg.save_in or "quantity", cfg[wesnoth.get_variable "difficulty"])
I know I have a lot to learn... :oops:

Post Reply