You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- First, we call <code>await client.get_user(2067807455)</code>. ro.py asks Roblox for information about the user with the ID 2067807455 and returns it as a User object.<br/>
1942
1942
- Next, we iterate through <code>user.username_history</code>. ro.py asks Roblox for the username history for user 2067807455 and returns it to you. </p>
1943
1943
<p>In this code, we call <code>await client.get_user()</code>, but we don't use any user information, like <code>user.name</code> or <code>user.description</code>. We don't need to make this request! </p>
1944
-
<p>ro.py lets you do this with the <code>client.get_base_TYPE</code>functions. We'll can the <code>client.get_base_user()</code> function to improve the code:
1944
+
<p>ro.py lets you skip the "information request" with the <code>client.get_base_TYPE</code>methods. We can use the <code>client.get_base_user()</code> function to improve this code:
1945
1945
<divclass="highlight"><pre><span></span><code><spanclass="n">user</span><spanclass="o">=</span><spanclass="n">client</span><spanclass="o">.</span><spanclass="n">get_base_user</span><spanclass="p">(</span><spanclass="mi">2067807455</span><spanclass="p">)</span><spanclass="c1"># no await!</span>
<p>There's another technique we can use to optimize this example further. For functions that accept only one type, like <code>kick_user</code> which always accepts a user, ro.py accepts bare user IDs:
1958
+
<p>There's another technique we can use to optimize this example further. For functions that accept only one type, like <code>kick_user</code> which always accepts a user, ro.py accepts bare IDs:
0 commit comments