> ## Documentation Index
> Fetch the complete documentation index at: https://docs.projectreal.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# Scripts

> Zapytania dotyczące skryptów, kodu bajtowego i środowiska.

<div className="real-category-page">
  Zapytania dotyczące skryptów, kodu bajtowego i środowiska.

  ## Dostępne funkcje

  <CardGroup cols={2}>
    <Card title="decompile" href="./decompile">
      Dekompiluje Roblox script i zwraca wygenerowany source text, gdy bytecode jest dostępny. argument musi być obsługiwaną script Instance. Jeśli użyteczny bytecode nie jest dostępny, function zwraca nil.
    </Card>

    <Card title="dumpstring" href="./dumpstring">
      Zwraca decompressed bytecode string dla Roblox script object. dumpstring jest zarejestrowany do tej samej C++ function co getscriptbytecode, wiec jego zachowanie jest identyczne. argument musi byc object. Wspolny bytecode reader akceptuje wartosci ClassName ModuleScript, LocalScript, CoreScript i Script. Dla Script RunContext musi byc Client. Jesli ClassName brakuje, function wyrzuca "Invalid Instance". Jesli ClassName nie jest obslugiwana script class, function wyrzuca "Script expected". Jesli wartosc jest Script z innym RunContext, function wyrzuca "Expected a Script with RunContext set to Client". Jesli embedded bytecode reference jest nieprawidlowy albo dlugosc stored bytecode wynosi 8 bytes lub mniej, function zwraca nil. W przeciwnym razie dekompresuje stored bytecode przez DecompressBytecode i zwraca resulting bytes jako Luau string. Hash mismatch, too-short compressed data albo ZSTD decompression errors sa zwracane jako error text bytes przez DecompressBytecode zamiast byc wyrzucane tutaj.
    </Card>

    <Card title="getcallingscript" href="./getcallingscript">
      Zwraca script zapisany na current Luau thread object. Function nie przyjmuje zadnych arguments. Odczytuje the current thread script, ktore jest stored reference. Jesli ten stored reference nie jest expired, function wypycha script Instance przez Instance cache i ja zwraca. Jesli stored reference jest expired, function zwraca nil. Function nie sprawdza Lua call stack, nie szuka ancestor scripts i nie sprawdza script ClassName.
    </Card>

    <Card title="getinstancesbyclass" href="./getinstancesbyclass">
      Zwraca instances z Instance cache table, ktorych ClassName field dokladnie pasuje do zadanego string. Pierwszy argument jest odczytywany przez string type checking. Empty string wyrzuca "ClassName required". Function tworzy nowa array table, iteruje cache zapisana pod Instance cache, zachowuje tylko values, ktorych Lua type to object, odczytuje ClassName field kazdego object value i porownuje go przez strcmp z zadanym className. Matches sa wstawiane sequential od index 1. Dopasowanie jest exact i case-sensitive. Function nie uzywa IsA, nie obejmuje subclasses, nie wykonuje walk descendants, nie filtruje po Parent i nie sortuje result. getinstancesofclass jest alias tej samej function.
    </Card>

    <Card title="getloadedmodules" href="./getloadedmodules">
      Returns a new array table containing live entries from loaded module list. The optional excludeCore argument is read with optional boolean handling and defaults to true when omitted or nil. If excludeCore is true, entries whose instance is a descendant of core packages or CoreGui are skipped. Expired weak entries and locked stored references without a value are skipped. The function pushes each remaining entry with Instance cache at sequential array indexes starting at 1. The function does not check ClassName, does not sort the result, and does not walk the DataModel.
    </Card>

    <Card title="getmenv" href="./getmenv">
      Returns the environment table associated with a ModuleScript. The argument must be a ModuleScript object. Invalid objects raise "Invalid Instance", non-ModuleScript objects raise "ModuleScript expected", and ModuleScripts without an available thread raise "invalid thread". The function does not accept Script or LocalScript; use getsenv for those cases.
    </Card>

    <Card title="getreferencedby" href="./getreferencedby">
      Returns cached Instance values whose supported reference properties point to the provided Instance. The argument must be an Instance.
    </Card>

    <Card title="getrunningscripts" href="./getrunningscripts">
      Zwraca nowa array table z unique script Instances pobranymi z live Lua threads. Function nie przyjmuje arguments. Przechodzi przez the live Luau thread list, odczytuje kazdy thread node i pomija entries bez thread node, bez weak thread ref, bez LiveLuaRef, bez Lua state, bez object albo z expired Script stored reference. Dla kazdego pozostalego thread blokuje scriptThread->object->Script(), deduplikuje po script reference, wypycha Instance przez Instance cache i wstawia ja do kolejnych array indexes od 1. Function nie skanuje DataModel, nie sprawdza ClassName i nie sortuje result.
    </Card>

    <Card title="getscriptbytecode" href="./getscriptbytecode">
      Zwraca decompressed bytecode string dla Roblox script object. getscriptbytecode jest zarejestrowane na tej samej C++ function co dumpstring, wiec zachowanie jest identyczne. Argument musi byc object. Wspolny bytecode reader akceptuje wartosci ClassName ModuleScript, LocalScript, CoreScript i Script. Dla Script RunContext musi byc Client. Jesli ClassName brakuje, function rzuca "Invalid Instance". Jesli ClassName nie jest obslugiwana script class, rzuca "Script expected". Jesli wartosc jest Script z innym RunContext, rzuca "Expected a Script with RunContext set to Client". Jesli embedded bytecode reference jest nieprawidlowy albo dlugosc stored bytecode wynosi 8 bytes lub mniej, function zwraca nil. W przeciwnym razie dekompresuje stored bytecode przez DecompressBytecode i zwraca resulting bytes jako Luau string. Hash mismatch, too-short compressed data albo ZSTD decompression errors sa zwracane jako error text bytes przez DecompressBytecode zamiast byc wyrzucane tutaj.
    </Card>

    <Card title="getscriptclosure" href="./getscriptclosure">
      Loads the stored bytecode for a supported Roblox script Instance and returns it as a Lua closure. Returns nil when usable bytecode is not available.
    </Card>

    <Card title="getscripthash" href="./getscripthash">
      Zwraca uppercase SHA384 hex digest dla stored bytecode string z Roblox script object. Argument musi byc object. Wspolny helper GetBytecode akceptuje wartosci ClassName ModuleScript, LocalScript, CoreScript i Script. Dla Script, RunContext musi byc Client. Jesli brakuje ClassName, function rzuca "Invalid Instance". Jesli ClassName nie jest jedna z obslugiwanych script classes, rzuca "Script expected". Jesli wartosc jest Script z innym RunContext, rzuca "Expected a Script with RunContext set to Client". Jesli embedded bytecode reference jest nieprawidlowy albo dlugosc stored bytecode wynosi 8 bytes lub mniej, function zwraca nil. W przeciwnym razie hashuje dokladne stored bytecode bytes przez SHA384 i zwraca uppercase hex string. Function nie wywoluje DecompressBytecode i nie hashuje decompressed bytecode.
    </Card>

    <Card title="getscripts" href="./getscripts">
      Zwraca wartosci script object obecne aktualnie w Instance cache. Function nie przyjmuje arguments. Iteruje cache zapisana pod kluczem Instance cache lightobject i bierze pod uwage tylko entries, ktorych value jest object. Odczytuje pole ClassName kazdej value przez optional string handling. Entries LocalScript i ModuleScript sa wlaczane. Entries Script sa wlaczane tylko wtedy, gdy ich RunContext offset rowna sie CLIENT albo PLUGIN. Inne wartosci ClassName, entries bez string ClassName i entries CoreScript sa pomijane. Wynikiem jest sekwencyjna Luau table. Function nie przechodzi przez DataModel i nie gwarantuje sorted order.
    </Card>

    <Card title="getscriptthread" href="./getscriptthread">
      Zwraca Lua thread powiazany z script object, gdy Real moze go znalezc. Argument musi byc object. Function odczytuje pole ClassName wartosci i rzuca "not a valid Instance", jesli to pole nie jest string. Akceptowane wartosci ClassName to Script, LocalScript i ModuleScript; kazda inna wartosc rzuca "Script expected". Najpierw sprawdza ScriptThreadCache Real przez script reference. Przy cache hit zwraca zapisany Luau thread jako thread. Przy cache miss wartosci Script musza miec RunContext Client, inaczej function rzuca "Expected a Script with RunContext set to Client". Nastepnie przechodzi przez the live Luau thread list, podaza first weak thread reference kazdego thread node do LiveLuaRef, pomija missing thread data lub expired Script stored references i porownuje kazdy script reference z zadanym script. Jesli znajdzie match, zwraca ten Luau thread jako thread. Jesli nie znajdzie match, zwraca nil.
    </Card>

    <Card title="getsenv" href="./getsenv">
      Returns the environment table associated with a LocalScript, Script, or ModuleScript. Unsupported script objects or scripts without an available thread raise the same errors as the underlying script lookup.
    </Card>

    <Card title="loadstring" href="./loadstring">
      Compiles a Luau source string and returns the loaded function. If loading fails, it returns nil and an error message. The returned function is not executed automatically.
    </Card>
  </CardGroup>
</div>
