Geo Posted April 25, 2020 Posted April 25, 2020 Pretty simple question, but got me thinking a lot. Creating a GUI with tables: gui_elements = {} gui_elements["login_box"] = guiCreateWindow(0.39, 0.29, 0.21, 0.43, "", true) gui_elements["user_input"] = guiCreateMemo(0.16, 0.15, 0.66, 0.13, "", true, login_box) gui_elements["password_input"] = guiCreateMemo(0.16, 0.30, 0.66, 0.13, "", true, login_box) gui_elements["big_button"] = guiCreateButton(0.17, 0.47, 0.43, 0.11, "", true, login_box) gui_elements["small_button"] = guiCreateButton(0.68, 0.47, 0.15, 0.12, "", true, login_box) Creates a different sized GUI than like this: login_box = guiCreateWindow(0.39, 0.29, 0.21, 0.43, "", true) user_input = guiCreateMemo(0.16, 0.15, 0.66, 0.13, "", true, login_box) password_input = guiCreateMemo(0.16, 0.30, 0.66, 0.13, "", true, login_box) big_button = guiCreateButton(0.17, 0.47, 0.43, 0.11, "", true, login_box) small_button = guiCreateButton(0.68, 0.47, 0.15, 0.12, "", true, login_box) Why is this?
Moderators IIYAMA Posted April 25, 2020 Moderators Posted April 25, 2020 3 hours ago, Geo said: Why is this? Because in the first example, login_box is not defined. So: gui_elements = {} gui_elements["login_box"] = guiCreateWindow(0.39, 0.29, 0.21, 0.43, "", true) gui_elements["user_input"] = guiCreateMemo(0.16, 0.15, 0.66, 0.13, "", true, gui_elements["login_box"]) gui_elements["password_input"] = guiCreateMemo(0.16, 0.30, 0.66, 0.13, "", true, gui_elements["login_box"]) gui_elements["big_button"] = guiCreateButton(0.17, 0.47, 0.43, 0.11, "", true, gui_elements["login_box"]) gui_elements["small_button"] = guiCreateButton(0.68, 0.47, 0.15, 0.12, "", true, gui_elements["login_box"]) 1 Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Geo Posted April 25, 2020 Author Posted April 25, 2020 Just now, IIYAMA said: Because in the first example, login_box is not defined. So: gui_elements = {} gui_elements["login_box"] = guiCreateWindow(0.39, 0.29, 0.21, 0.43, "", true) gui_elements["user_input"] = guiCreateMemo(0.16, 0.15, 0.66, 0.13, "", true, gui_elements["login_box"]) gui_elements["password_input"] = guiCreateMemo(0.16, 0.30, 0.66, 0.13, "", true, gui_elements["login_box"]) gui_elements["big_button"] = guiCreateButton(0.17, 0.47, 0.43, 0.11, "", true, gui_elements["login_box"]) gui_elements["small_button"] = guiCreateButton(0.68, 0.47, 0.15, 0.12, "", true, gui_elements["login_box"]) Yeah, I realized my mistake. Embarrasing! 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now