I just tested, because I havent been able to test before (I was in portugal ), I have tried as it says in the wiki.kovarex wrote:Ok, I wrote simple wiki page about styles and lua, I hope it is understandable if not, let me know.
https://forums.factorio.com/wiki/index.php/Lua/Style
Edit:Maybe because of this typo?ficolas wrote: minimunwidth field inside style is nil
Code: Select all
button = game.player.gui.add{type="button", name="mybutton", caption="Hello world"}
button.style = "menu_button_style"
button.style.minimalwidth = 15
Code: Select all
button = game.player.gui.left.add{type="button", name="mybutton", caption="Hello world"}
button.style = "menu_button_style"
button.style.minimalwidth = 150
I can change the variable, but it is not shown in the game.
Also, the variables "width" and "height" donesnt even exist.
also the following code:
Code: Select all
newmenu() --this jst removes the older menu
game.player.gui.left.add({type="frame", name="menu", caption="Wireless"})
game.player.gui.left.menu.add({type="flow",name="addsub",caption="",direction="horizontal"})
game.player.gui.left.menu.add({type="flow",name="buttons",caption="",direction="vertical"})
game.player.gui.left.menu.buttons.add({type="button", name="substract", caption=" - "})
game.player.gui.left.menu.buttons.add({type="button", name="Toggle", caption="Toggle"})
game.player.gui.left.menu.buttons.add({ type="button", name="Close", caption="Close"})
game.player.gui.left.menu.addsub.add({type="button", name="add", caption=" + "})
game.player.gui.left.menu.addsub.add({type="button", name="count", caption="1"})