Is there an easy way to set and get position of a gui node when the screen have been resized? (SOLVED)

I’m trying to wrap my head around this, with the simplest example possible. The aim is to make the “pie” node always appear in the top right corner.

local node = gui.get_node("pie")
local window_w,window_h = camera.get_window_size()
local config_w = sys.get_config("display.width")
local config_h = sys.get_config("display.height")
local x = window_w * (config_w/window_w)
local y = window_h * (config_h/window_h)
gui.set_position(node, vmath.vector3(x,y,0))

The result (before and after window resize):


What changes are needed for it to work?

GUIPositioning.zip (234.9 KB)

Edit: Found this post. Is this what I need to do? This is hard!