{"id":13664875,"url":"https://github.com/pangweiwei/slua","last_synced_at":"2025-05-15T18:02:09.546Z","repository":{"id":43803417,"uuid":"29187878","full_name":"pangweiwei/slua","owner":"pangweiwei","description":"Fastest lua binding via static code generating for Unity3D and mono.","archived":false,"fork":false,"pushed_at":"2022-02-18T04:39:24.000Z","size":49160,"stargazers_count":1410,"open_issues_count":33,"forks_count":436,"subscribers_count":173,"default_branch":"master","last_synced_at":"2025-03-31T21:51:17.401Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pangweiwei.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-01-13T11:59:00.000Z","updated_at":"2025-03-30T14:53:54.000Z","dependencies_parsed_at":"2022-08-12T10:50:23.077Z","dependency_job_id":null,"html_url":"https://github.com/pangweiwei/slua","commit_stats":null,"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pangweiwei%2Fslua","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pangweiwei%2Fslua/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pangweiwei%2Fslua/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pangweiwei%2Fslua/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pangweiwei","download_url":"https://codeload.github.com/pangweiwei/slua/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247737788,"owners_count":20987721,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-08-02T05:03:10.816Z","updated_at":"2025-04-07T22:10:59.448Z","avatar_url":"https://github.com/pangweiwei.png","language":"C","readme":"# slua\nFastest lua binding via static code generating for Unity3D or mono\n\nWebsite: http://www.slua.net\n\nslua for Unreal https://github.com/Tencent/sluaunreal\n\n## Continuous Integration Build\n\n| Build | Platform | Type    | Status  |\n| ---   | ---      | ---     | ---     |\n| *slua-unity* | None | None | None |\n| **slua-standalone** | Linux   | Test,Build | [![Build Status](https://travis-ci.org/mr-kelly/slua.svg)](https://travis-ci.org/mr-kelly/slua) |\n| **slua-standalone** | Windows | Test,Build,Deploy | [![Build status](https://ci.appveyor.com/api/projects/status/vokwhnu95lx5e8g3?svg=true)](https://ci.appveyor.com/project/mr-kelly/slua) |\n\n## Release Download\n\n- [slua-unity](https://github.com/pangweiwei/slua/releases/latest)\n- [slua-standalone](https://www.nuget.org/packages/slua-standalone)\n\n## Integrate with 3rd Lua Library\n\nStandard slua release doesn't contains any 3rd Lua library(like protobuf, lpeg etc), if you want to use this library, can visit this forked repo https://github.com/luzexi/slua, it focus slua on integrate with other 3rd library.\n\n## Use SLua without Unity3D\n\nYou can use slua without Unity3D dependency, it call **slua-standalone**. Useful for C# server development. Find it on https://www.nuget.org/packages/slua-standalone , and it's maintained by https://github.com/mr-kelly/slua.\n\n\n## Framework with slua\n\nYou can use this framework to start your project.\n\nThis repo https://github.com/lwkl/xproject universal loading framework using slua load lua byte code in all platform.\n\nThis repo http://linkcloud.github.io/ poker game using slua.\n\nThis repo https://github.com/mr-kelly/KSFramework based on slua for hot reloadable asset bundle framework.\n\nThis repo https://github.com/lulersoft/ME_SLua based on slua for simple game framework.\n\nThis repo https://github.com/yaukeywang/2DPlatformer-SLua demonstrate 2DPlatformer game using slua.\n\nThis repo https://github.com/tenvick/hugula demonstrate Tetris game using slua.\n\n## Help\n\nSee inner demo for help or [Document](https://github.com/pangweiwei/slua/wiki) (in chinese).\n\n## Important\n\nFor running demo sucessful, you should generate lua wrap file by your self:\n\nClick menu, SLua-\u003eAll-\u003eMake  generate all wrap file for your version of unity.\n\n***Had tested for Unity4.6.1/4.6.2/4.6.3/5.0/5.1/5.2/5.3/5.4/5.5***\n\n## Main feature\n\n- static code generating, no reflection, no extra gc alloc, very fast\n- remote debugger\n- full support iOS/iOS64, support il2cpp\n- above 90% UnityEngine interface exported ( remove flash, platform dependented interface )\n- 100% UnityEngine.UI interface ( require Unity4.6+ )\n- support standalone mode in .net framework/mono without Unity3D\n- support UnityEvent/UnityAction for event callback via lua function\n- support delegate via lua function (include iOS)\n- support yield call\n- support custom class exported\n- support extension method\n- export enum as integer\n- return array as lua table\n- using raw luajit, can be replaced with lua5.3/lua5.1\n\n## Usage\n\ncopy Assets/Plugins Assets/Slua to your $Project$/Assets folder, you will see Slua menu, \n\nclick Unity-\u003eMake UnityEngine, regenerate UnityEngine interface for lua\n\nclick Unity-\u003eMake UI, regenerate UnityEngine.UI interface for lua\n\nclick Custom-\u003eMake, generate custom class interface for lua\n\nClear custom, delete all generated custom interface\n\nSlua/LuaObject contain pre-generated file for exported interface.\n\nPrecompiled slua library in Plugins only included x86(32bit)/macosx(32bit)/iOS(armv7,armv7s,arm64)/Android(armv7-a) platform using luajit, you should compile other platform/lua5.1/luajit by yourself, see build.txt for help.\n\n\n## Usage at a glance\n\n~~~~~~~~~~lua\n\n-- import\nimport \"UnityEngine\"\n\nfunction main()\n\n\t-- create gameobject\n\tlocal cube = GameObject.CreatePrimitive(UnityEngine.PrimitiveType.Cube)\n\n\t-- find gameobject\n\tlocal go = GameObject.Find(\"Canvas/Button\")\n\t\n\t-- get component by type name\n\tlocal btn = go:GetComponent(\"Button\")\n\t\n\t-- get out parameter\n\tlocal ok,hitinfo = Physics.Raycast(Vector3(0,0,0),Vector3(0,0,1),Slua.out)\n\tprint(\"Physics Hitinfo\",ok,hitinfo)\n\t\n\t-- foreach enumeratable object\n\tfor t in Slua.iter(Canvas.transform) do\n\t\tprint(\"foreach transorm\",t)\n\tend\n\t\n\t-- add event listener\n\tbtn.onClick:AddListener(function()\n\t\tlocal go = GameObject.Find(\"Canvas/Text\")\n\t\tlocal label = go:GetComponent(\"Text\")\n\t\tlabel.text=\"hello world\"\n\tend)\n\t\n\t-- use vector3\n\tlocal pos = Vector3(10,10,10)+Vector3(1,1,1)\n\tcube.transform.position = pos\n\t\n\t-- use coroutine\n\tlocal c=coroutine.create(function()\n\t\tprint \"coroutine start\"\n\n\t\tYield(WaitForSeconds(2))\n\t\tprint \"coroutine WaitForSeconds 2\"\n\n\t\tlocal www = WWW(\"http://www.sineysoft.com\")\n\t\tYield(www)\n\t\tprint(#Slua.ToString(www.bytes))\n\tend)\n\tcoroutine.resume(c)\n\n\t-- add delegate\n\tDeleg.daction = {\"+=\",self.actionD} --it's ok for iOS\n\t\n\t-- remove delegate\n\tDeleg.daction = {\"-=\",self.actionD} --it's ok for iOS\n\t\n\t-- set delegate\n\tDeleg.daction = function() print(\"callback\") end --it's ok for iOS\n\t\n\t-- remove all\n\tDeleg.daction = nil\nend\n\n~~~~~~~~~~\n\n\n## Export custom class\n\nadd CustomLuaClass attribute to your custom class, waiting for compile completed, click \"SLua-\u003eCustom-\u003eMake\", you will get interface file for lua.\n\n~~~~~~~~~~c#\n\n[CustomLuaClass]\npublic class HelloWorld   {\n\n}\n\n~~~~~~~~~~\n\n\n## Debugger Support\n\nhttps://github.com/Tencent/luapanda\n\n\n### Benchmark\n\ncompared with ulua/raw mono.\n\n**with luajit**\n\n\n![](benchmark.png)\n\n\nunit is secend, run 200k times / test, more smarller more better.\n\n","funding_links":[],"categories":["C","Open Source Repositories","Lua","Open Source Packages","Script"],"sub_categories":["Lua","Reactive"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpangweiwei%2Fslua","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpangweiwei%2Fslua","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpangweiwei%2Fslua/lists"}