{
  "classes": [
    {
      "constants": [],
      "types": [],
      "name": "@eryx/_ffi",
      "tags": [],
      "functions": [
        {
          "source": {
            "path": "",
            "line": 167
          },
          "is_method": false,
          "signature": "_ffi.loadLibrary(\n    path: string  -- The file name or full path of the library to load.\n) → (\n    ForeignLibrary  -- A handle to the loaded library. \n)",
          "owner": "_ffi",
          "desc": "Loads a native shared library (DLL) by file name or path.\n\nThe library is kept loaded until the returned [[ForeignLibrary]] is\ngarbage-collected.\n\n```luau\nlocal kernel32 = _ffi.loadLibrary(\"kernel32.dll\")\n```\n",
          "tags": [],
          "name": "loadLibrary",
          "return_str": "ForeignLibrary",
          "function_type": "Function",
          "returns": [
            {
              "lua_type": "ForeignLibrary",
              "desc": "A handle to the loaded library. "
            }
          ],
          "params": [
            {
              "lua_type": "string",
              "name": "path",
              "desc": "The file name or full path of the library to load."
            }
          ]
        }
      ],
      "properties": [],
      "source": {
        "path": "",
        "line": 0
      },
      "desc": "Foreign Function Interface for Luau.\n\nLoads native shared libraries (DLLs) at runtime and invokes their\nexported C functions directly from Luau.  Values are marshalled through\ntyped [[ForeignValue]] wrappers to ensure correct ABI alignment.\n\n:::caution\nThis is a **low-level** API.  Incorrect type declarations or pointer\narithmetic will crash the process - there are no safety nets once you\ncross the FFI boundary.\n:::\n\n```luau\nlocal ffi = require(\"@eryx/_ffi\")\n\nlocal user32 = ffi.loadLibrary(\"user32.dll\")\nlocal msgBox = user32:getFunction(\n\t\"MessageBoxA\",\n\tffi.i32,\n\t{ ffi.u64, ffi.str:pointer(), ffi.str:pointer(), ffi.u32 }\n)\n\nlocal title = ffi.str(\"Hello from Luau!\")\nlocal body  = ffi.str(\"It works!\")\nmsgBox(ffi.u64(0), body:pointer(), title:pointer(), ffi.u32(0))\n```\n"
    },
    {
      "is_primary_export": false,
      "source": {
        "path": "",
        "line": 36
      },
      "tags": [],
      "properties": [],
      "desc": "A loaded native shared library (DLL).\n\nObtained via [[loadLibrary]].  The library remains loaded until the\nvalue is garbage-collected.\n",
      "name": "ForeignLibrary",
      "functions": [
        {
          "source": {
            "path": "",
            "line": 46
          },
          "is_method": true,
          "signature": "ForeignLibrary:getFunction(\n    name: string | number,  -- The exported symbol name, or a numeric ordinal.\n    retType: ForeignType,  -- The return type of the function.\n    argTypes: { ForeignType }  -- An array of argument types, in order.\n) → (\n    ForeignFunction  -- A callable wrapper for the native function. \n)",
          "desc": "Looks up an exported function by name or ordinal and returns a\ncallable [[ForeignFunction]].\n",
          "tags": [],
          "name": "getFunction",
          "return_str": "ForeignFunction",
          "function_type": "Method",
          "returns": [
            {
              "lua_type": "ForeignFunction",
              "desc": "A callable wrapper for the native function. "
            }
          ],
          "params": [
            {
              "lua_type": "string | number",
              "name": "name",
              "desc": "The exported symbol name, or a numeric ordinal."
            },
            {
              "lua_type": "ForeignType",
              "name": "retType",
              "desc": "The return type of the function."
            },
            {
              "lua_type": "{ ForeignType }",
              "name": "argTypes",
              "desc": "An array of argument types, in order."
            }
          ]
        }
      ],
      "metamethods": [],
      "types": []
    },
    {
      "is_primary_export": false,
      "source": {
        "path": "",
        "line": 60
      },
      "tags": [],
      "properties": [],
      "desc": "A resolved native function that can be called from Luau.\n\nCalling the function with the correct number and types of arguments\nreturns a [[ForeignValue]] containing the return value.\n",
      "name": "ForeignFunction",
      "functions": [
        {
          "source": {
            "path": "",
            "line": 71
          },
          "is_method": true,
          "signature": "ForeignFunction:__call() → (\n    ForeignValue  -- The return value wrapped in a ForeignValue. \n)",
          "desc": "Invokes the native function.\n\nArguments may be [[ForeignValue]] userdata *or* plain Luau values\nthat are automatically converted according to the declared argument\ntypes.\n",
          "tags": [],
          "name": "__call",
          "return_str": "ForeignValue",
          "function_type": "Method",
          "returns": [
            {
              "lua_type": "ForeignValue",
              "desc": "The return value wrapped in a ForeignValue. "
            }
          ],
          "params": []
        }
      ],
      "metamethods": [],
      "types": []
    },
    {
      "is_primary_export": false,
      "source": {
        "path": "",
        "line": 85
      },
      "tags": [],
      "properties": [],
      "desc": "A C type descriptor (e.g. `u32`, `str`, `i64`).\n\nType objects are callable - invoking one creates a new [[ForeignValue]]\nof that type, optionally initialised with a value.\n\n```luau\nlocal n = ffi.u32(42)   -- create a u32 with value 42\nlocal s = ffi.str(\"hi\") -- create a string value\n```\n",
      "name": "ForeignType",
      "functions": [
        {
          "source": {
            "path": "",
            "line": 93
          },
          "is_method": true,
          "signature": "ForeignType:pointer() → (\n    ForeignType  -- The pointer-to type. \n)",
          "desc": "Returns a new [[ForeignType]] representing a pointer to this type.\n\nCan be chained: `ffi.u32:pointer():pointer()` yields `u32**`.\n",
          "tags": [],
          "name": "pointer",
          "return_str": "ForeignType",
          "function_type": "Method",
          "returns": [
            {
              "lua_type": "ForeignType",
              "desc": "The pointer-to type. "
            }
          ],
          "params": []
        },
        {
          "source": {
            "path": "",
            "line": 104
          },
          "is_method": true,
          "signature": "ForeignType:__call(\n    initialValue: any?  -- An optional initial value.\n) → (\n    ForeignValue  -- The newly created value. \n)",
          "desc": "Creates a new [[ForeignValue]] of this type.\n\nIf `initialValue` is provided it is used to initialise the value;\notherwise the memory is zero-filled.\n",
          "tags": [],
          "name": "__call",
          "return_str": "ForeignValue",
          "function_type": "Method",
          "returns": [
            {
              "lua_type": "ForeignValue",
              "desc": "The newly created value. "
            }
          ],
          "params": [
            {
              "lua_type": "any?",
              "name": "initialValue",
              "desc": "An optional initial value."
            }
          ]
        }
      ],
      "metamethods": [],
      "types": []
    },
    {
      "is_primary_export": false,
      "source": {
        "path": "",
        "line": 114
      },
      "tags": [],
      "properties": [],
      "desc": "A boxed C value that can be read, written, and passed across the FFI\nboundary.\n\nPointer values can be dereferenced with [[ForeignValue.get|get()]] or\nturned into a pointer with [[ForeignValue.pointer|pointer()]].\n",
      "name": "ForeignValue",
      "functions": [
        {
          "source": {
            "path": "",
            "line": 128
          },
          "is_method": true,
          "signature": "ForeignValue:get(\n    dereference: boolean?  -- For pointer values, pass `false` to get the raw numeric address instead of dereferencing.  Defaults to `true`.\n) → (\n    any  -- The Luau value, or a new ForeignValue for pointers. \n)",
          "desc": "Reads the value.\n\nFor scalar types this returns the corresponding Luau primitive\n(number or string).  For pointer types this dereferences the\npointer and returns a new [[ForeignValue]] one indirection level\nlower.\n",
          "tags": [],
          "name": "get",
          "return_str": "any",
          "function_type": "Method",
          "returns": [
            {
              "lua_type": "any",
              "desc": "The Luau value, or a new ForeignValue for pointers. "
            }
          ],
          "params": [
            {
              "lua_type": "boolean?",
              "name": "dereference",
              "desc": "For pointer values, pass `false` to get the raw numeric address instead of dereferencing.  Defaults to `true`."
            }
          ]
        },
        {
          "source": {
            "path": "",
            "line": 139
          },
          "is_method": true,
          "signature": "ForeignValue:set(\n    value: any  -- The new value to store.\n) → (\n    ForeignValue  -- self. \n)",
          "desc": "Overwrites the stored value.\n\nOnly valid for non-pointer scalar types.  Returns `self` for\nmethod chaining.\n",
          "tags": [],
          "name": "set",
          "return_str": "ForeignValue",
          "function_type": "Method",
          "returns": [
            {
              "lua_type": "ForeignValue",
              "desc": "self. "
            }
          ],
          "params": [
            {
              "lua_type": "any",
              "name": "value",
              "desc": "The new value to store."
            }
          ]
        },
        {
          "source": {
            "path": "",
            "line": 149
          },
          "is_method": true,
          "signature": "ForeignValue:pointer() → (\n    ForeignValue  -- A pointer to this value. \n)",
          "desc": "Returns a new [[ForeignValue]] that is a pointer to this value.\n\nThe returned pointer does **not** own the memory - the original\nvalue must be kept alive for the pointer to remain valid.\n",
          "tags": [],
          "name": "pointer",
          "return_str": "ForeignValue",
          "function_type": "Method",
          "returns": [
            {
              "lua_type": "ForeignValue",
              "desc": "A pointer to this value. "
            }
          ],
          "params": []
        }
      ],
      "metamethods": [],
      "types": []
    }
  ]
}