> Agent-readable docs index: /llms.txt. Download /docs.zip to grep all markdown files locally.

---
title: Cloud
icon: cloud
---

# <ApiPageIcon icon="cloud" />Cloud

<ApiExposes data="[{&#x22;k&#x22;:&#x22;NAMESPACE&#x22;,&#x22;c&#x22;:&#x22;fn&#x22;,&#x22;s&#x22;:&#x22;cloud&#x22;,&#x22;h&#x22;:&#x22;#cloud-1&#x22;},{&#x22;k&#x22;:&#x22;OBJECT&#x22;,&#x22;c&#x22;:&#x22;method&#x22;,&#x22;s&#x22;:&#x22;cloud.User&#x22;,&#x22;h&#x22;:&#x22;#clouduser&#x22;},{&#x22;k&#x22;:&#x22;OBJECT&#x22;,&#x22;c&#x22;:&#x22;method&#x22;,&#x22;s&#x22;:&#x22;cloud.Item&#x22;,&#x22;h&#x22;:&#x22;#clouditem&#x22;}]" />

<Heading level={2} id="cloud-1">
  cloud

  <ApiTag label="global table" />
</Heading>

Gets information about the user account, the running script, and the loaded config. Also
gives access to the files that are shipped with the script.

<ApiMembers>
  <ApiMember kind="fn" name="cloud.GetUser" summary="Returns information about the user who is logged in. Other code can fake this information, so do not use it for security checks." args="" sig="[{&#x22;s&#x22;:&#x22;cloud.GetUser&#x22;},{&#x22;s&#x22;:&#x22;(&#x22;},{&#x22;s&#x22;:&#x22;)&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;cloud.User&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/runtime/cloud#clouduser&#x22;}]" ret="[[{&#x22;s&#x22;:&#x22;cloud.User&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/runtime/cloud#clouduser&#x22;}]]" nodiscard />

  <ApiMember kind="fn" name="cloud.GetUsername" summary="Returns the login name of the user who is logged in. Other code can fake this name, so do not use it for security checks." args="" sig="[{&#x22;s&#x22;:&#x22;cloud.GetUsername&#x22;},{&#x22;s&#x22;:&#x22;(&#x22;},{&#x22;s&#x22;:&#x22;)&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;}]" ret="[[{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;}]]" nodiscard />

  <ApiMember kind="fn" name="cloud.GetScript" summary="Returns information about the script that is running." args="" sig="[{&#x22;s&#x22;:&#x22;cloud.GetScript&#x22;},{&#x22;s&#x22;:&#x22;(&#x22;},{&#x22;s&#x22;:&#x22;)&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;cloud.Item&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/runtime/cloud#clouditem&#x22;}]" ret="[[{&#x22;s&#x22;:&#x22;cloud.Item&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/runtime/cloud#clouditem&#x22;}]]" nodiscard />

  <ApiMember kind="fn" name="cloud.GetConfig" summary="Returns information about the config that is loaded." args="" sig="[{&#x22;s&#x22;:&#x22;cloud.GetConfig&#x22;},{&#x22;s&#x22;:&#x22;(&#x22;},{&#x22;s&#x22;:&#x22;)&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;cloud.Item&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/runtime/cloud#clouditem&#x22;}]" ret="[[{&#x22;s&#x22;:&#x22;cloud.Item&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/runtime/cloud#clouditem&#x22;}]]" nodiscard>
    <ApiNotes>
      Throws an error if no config is loaded. No config is loaded when the client starts, until the
      first config is applied. The error is also thrown if the loaded config was removed. Wrap the
      call in `pcall` if your code can run at these times.
    </ApiNotes>
  </ApiMember>

  <ApiMember kind="fn" name="cloud.ReadResource" summary="Returns the full path on disk to a file or folder that is shipped with the running script, such as an image or a sound. Returns an empty string if the script has no file or folder with that name." args="name" sig="[{&#x22;s&#x22;:&#x22;cloud.ReadResource&#x22;},{&#x22;s&#x22;:&#x22;(&#x22;},{&#x22;s&#x22;:&#x22;name&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;},{&#x22;s&#x22;:&#x22;)&#x22;},{&#x22;s&#x22;:&#x22;: &#x22;},{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;}]" ret="[[{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;}]]" params="[{&#x22;n&#x22;:&#x22;name&#x22;,&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;}],&#x22;d&#x22;:&#x22;The name of the file or folder, relative to the root folder of the script.&#x22;}]" returns="[{&#x22;t&#x22;:[{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;}],&#x22;d&#x22;:&#x22;The full path on disk, or an empty string.&#x22;}]" nodiscard>
    <ApiNotes>
      `name` is relative to the root folder of the script. For a developer script, the path points
      into the folder of the script. For a market script, the file is first extracted to a temporary
      folder. If `name` is a folder, every file in it is extracted. So the folder on disk has the
      same files for both kinds of script.

      `filesystem.List`, `filesystem.Read` and `filesystem.Info` accept the returned path. They also
      accept other paths in the files of the script that are built from it, such as its parent
      folder. This also works for market scripts.
    </ApiNotes>
  </ApiMember>
</ApiMembers>

## cloud.User<ApiTag label="object type" />

Information about the user who is logged in.

<ApiMembers>
  <ApiMember kind="prop" name="cloud.User.avatar" summary="The avatar image." ret="[[{&#x22;s&#x22;:&#x22;Image&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/rendering/render#image&#x22;}]]" />

  <ApiMember kind="prop" name="cloud.User.license" summary="The license code of the account." ret="[[{&#x22;s&#x22;:&#x22;integer&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#integer&#x22;}]]" />

  <ApiMember kind="prop" name="cloud.User.name" summary="The login name." ret="[[{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;}]]" />
</ApiMembers>

## cloud.Item<ApiTag label="object type" />

Information about a script or a config.

<ApiMembers>
  <ApiMember kind="prop" name="cloud.Item.author" summary="The author of the item." ret="[[{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;}]]" />

  <ApiMember kind="prop" name="cloud.Item.id" summary="The ID of the item in the cloud. It stays the same across sessions. A developer script is not in the cloud, so its ID is valid only for the current session. Do not save the ID of a developer script." ret="[[{&#x22;s&#x22;:&#x22;integer&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#integer&#x22;}]]" />

  <ApiMember kind="prop" name="cloud.Item.is_market" summary="`true` if the item comes from the market." ret="[[{&#x22;s&#x22;:&#x22;boolean&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#boolean&#x22;}]]" />

  <ApiMember kind="prop" name="cloud.Item.modify_time" summary="The time the item was last modified, as a Unix timestamp in seconds." ret="[[{&#x22;s&#x22;:&#x22;int64_t&#x22;,&#x22;k&#x22;:&#x22;class&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#int64_t&#x22;}]]" />

  <ApiMember kind="prop" name="cloud.Item.name" summary="The name of the item." ret="[[{&#x22;s&#x22;:&#x22;string&#x22;,&#x22;k&#x22;:&#x22;prim&#x22;,&#x22;h&#x22;:&#x22;/cs2/api_reference/lua/base#string&#x22;}]]" />
</ApiMembers>
