Page 1 of 1

luaPlayer:settings

Posted: Thu May 11, 2017 6:57 am
by Nexela
luaPlayer:settings -- just a simple shortcut that returns settings.get_player_settings(player)

Re: luaPlayer:settings

Posted: Thu May 11, 2017 7:50 am
by bobingabout
Not to say that you idea is bad, but, if you have settings.get_player_settings(player), why would you need to do game.players[player_index].settings?
Q: does get_player_settings take player, or player_index?

if it takes index, there's no real need to add settings to LuaPlayer, however, if it takes player directly, then I can see how it could really cut things down to use player.settings.

Re: luaPlayer:settings

Posted: Thu May 11, 2017 8:04 am
by Nexela
get_player_settings() takes a luaPlayer, an index or a name


Usually by time I need a settings I already have the player so being able to do

Code: Select all

player.settings["mod-seting-name"].value  
is a lot quicker and cleaner then doing

Code: Select all

settings.get_player_settings(player)["mod-setting-name"].value

Re: luaPlayer:settings

Posted: Thu May 11, 2017 9:15 am
by Mooncat
How about LuaPlayer::mod_settings?
I think it was added in 0.15.7.

Note: empty note. lol

Re: luaPlayer:settings

Posted: Thu May 11, 2017 10:13 am
by bobingabout
that sounds like what you want is actually already in there

note: I haven't edited any of my scripting at all in 0.15, everything from 0.14 just seemed to work (Except for magical inserter dancing when you press SHIFT + R, because it triggers both the new base game's rotate left, and my script's rotate the input postion. this can be fixed by redefining either hotkey)

Re: luaPlayer:settings

Posted: Thu May 11, 2017 3:42 pm
by Rseding91
I fixed the empty note for 0.15.11. It just says it can be come invalid if the player is removed.

Re: luaPlayer:settings

Posted: Thu May 11, 2017 7:25 pm
by Nexela
Mooncat wrote:How about LuaPlayer::mod_settings?
I think it was added in 0.15.7.

Note: empty note. lol
Ohhh I missed that ! Thanks