{"id":15008118,"url":"https://github.com/jooonior/lua_plugin","last_synced_at":"2026-03-13T09:34:32.002Z","repository":{"id":255646770,"uuid":"851777079","full_name":"jooonior/lua_plugin","owner":"jooonior","description":"Source engine plugin that embeds LuaJIT and delegates the plugin callbacks to Lua.","archived":false,"fork":false,"pushed_at":"2024-09-27T23:21:13.000Z","size":75,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-12-25T21:00:45.819Z","etag":null,"topics":["csgo","hl2","lua","luajit","source-engine","team-fortress-2","tf2"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jooonior.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-03T17:26:53.000Z","updated_at":"2024-09-27T23:21:16.000Z","dependencies_parsed_at":"2024-10-12T08:31:23.852Z","dependency_job_id":null,"html_url":"https://github.com/jooonior/lua_plugin","commit_stats":null,"previous_names":["jooonior/lua_plugin"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/jooonior/lua_plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jooonior%2Flua_plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jooonior%2Flua_plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jooonior%2Flua_plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jooonior%2Flua_plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jooonior","download_url":"https://codeload.github.com/jooonior/lua_plugin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jooonior%2Flua_plugin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30464858,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-13T06:34:02.089Z","status":"ssl_error","status_checked_at":"2026-03-13T06:33:49.182Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csgo","hl2","lua","luajit","source-engine","team-fortress-2","tf2"],"created_at":"2024-09-24T19:15:11.336Z","updated_at":"2026-03-13T09:34:31.909Z","avatar_url":"https://github.com/jooonior.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lua_plugin\n\nSource engine plugin that embeds [LuaJIT][LuaJIT] and delegates the plugin\ncallbacks to Lua.\n\nThis is useful mainly for writing simple client plugins. I wouldn't recommend it\nfor anything complex, since Lua's debugging capabilities are rather limited\ncompared to C++. Also there is no SDK...\n\nThis README assumes that you are already familiar with writing plugins for\nSource engine games and Lua.\n\n\n## Compatibility\n\nBoth 32 and 64-bit games are supported, on both Windows and Linux. Keep it mind\nthat you need a different version of the plugin binaries for each of those four\ncombinations.\n\n### Source\n\nAll Source engine games _should_ work.\n\n\u003cdetails\u003e\n  \u003csummary\u003eTechnical details\u003c/summary\u003e\n\n  The plugin does not depend on any engine interfaces and only uses logging\n  functions from [`tier0`][tier0]. All it does is expose its callbacks under\n  versions 1 to 3 of the [`IServerPluginCallbacks`][IServerPluginCallbacks]\n  interface. Any game that supports those versions will work.\n\n\u003c/details\u003e\n\n\n### Source 2\n\nSource 2 has a different plugin system. It is **not supported** and never will\nbe.\n\n\n## Quickstart\n\nThis section uses Windows filenames. On Linux, substitute `lua_plugin.dll` and\n`lua51.dll` for `lua_plugin.so` and `libluajit.*.so.*`, respectively.\n\nTo create a new standalone plugin:\n\n1. Download and extract `lua_plugin.dll` and `lua51.dll` from the\n   [latest release](https://github.com/jooonior/lua_plugin/releases/latest).\n\n2. Rename `lua_plugin.dll` to `\u003cyour plugin name\u003e.dll`.\n\n3. Create `\u003cyour plugin name\u003e.lua` (or `\u003cyour plugin name\u003e/init.lua`) next to\n   the plugin DLL.\n\n   ```lua\n   local Plugin = {}\n\n   function Plugin:Load()\n      print(\"Hello World!\")\n   end\n\n   return Plugin\n   ```\n\n   See [`mod/addons/lua_plugin.lua`](mod/addons/lua_plugin.lua) for a more\n   complex example.\n\n4. Pray you didn't make any mistakes with FFI and it doesn't segfault.\n\nNote that `lua51.dll` is linked dynamically, which means that the plugin will\nnot work without it.\n\n## Semantics\n\nWhen loaded, the plugin binary finds and executes a Lua module matching its\nname (that is `?.lua` or `?/init.lua` where `?` is the plugin binary path\nwithout extension). This Lua module is expected to return a table of functions\ncorresponding to the [`IServerPluginCallbacks`][IServerPluginCallbacks]\ncallbacks. These functions are optional --- missing ones will be handled in the\nplugin binary.\n\nEach plugin callback delegates to a Lua function of the same name (if defined).\nArguments are forwarded to Lua and return values are forwarded back. Pointer and\nreference arguments are passed as _light userdata_ and have to be cast using\n[`ffi.cast`][ffi.cast] to their respective _ctypes_ before being useful.\n\nThe only modifications to the Lua environment are:\n\n- `print` and `warn` print to the in-game console\n- `arg[0]` contains the full path to the main Lua module\n- [`package.path`][package.path] is set to `?.lua` and `?/init.lua` inside of\n  the directory with the plugin binary\n- [`package.cpath`][package.cpath] is set to `?.dll`/`?.so` and\n  `loadall.dll`/`loadall.so` inside of the directory with the plugin binary\n- `INTERFACEVERSION_ISERVERPLUGINCALLBACKS` is set to the selected\n  `IServerPluginCallbacks` interface version\n\nNo other integration with the engine is implemented. You are expected to use\nLuaJIT's [`ffi`][ffi] library for interacting with the engine.\n\n\n## Changelog\n\nSee [CHANGELOG.md](./CHANGELOG.md).\n\n\n## Building\n\nThe plugin and its dependencies are built with CMake. Check out the\n[`build` GitHub action](./.github/actions/build/action.yml) to see how.\n\n\n## Debugging\n\nYou can debug the plugin straight from Visual Studio 2022. Debugging is\nconfigured in [`.vs/launch.vs.json`](./.vs/launch.vs.json). Keep in mind that\nyou can't debug a 32-bit build in a 64-bit game (and vice versa).\n\n[LuaJIT]: https://luajit.org/\n[IServerPluginCallbacks]: https://developer.valvesoftware.com/wiki/IServerPluginCallbacks\n[tier0]: https://github.com/ValveSoftware/source-sdk-2013/blob/master/mp/src/public/tier0/dbg.h\n[ffi]: https://luajit.org/ext_ffi.html\n[ffi.cast]: https://luajit.org/ext_ffi_api.html#ffi_cast\n[package.path]: https://www.lua.org/manual/5.1/manual.html#pdf-package.path\n[package.cpath]: https://www.lua.org/manual/5.1/manual.html#pdf-package.cpath\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjooonior%2Flua_plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjooonior%2Flua_plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjooonior%2Flua_plugin/lists"}