Code Monkey home page Code Monkey logo

tolua's Introduction

#tolua*#*

tolua# is a Unity lua static binder solution. the first solution that analyzes code by reflection and generates wrapper classes.

It is a Unity plugin that greatly simplifies the integration of C# code with Lua. which can automatically generate the binding code to access Unity from Lua and map c# constants, variables, functions, properties, classes, and enums to Lua.

tolua# grows up from cstolua. it's goal is to be a powerful development environment for Unity.

Support unity4.6.x and Unity5.x all(copy /Unity5.x/Assets to /Assets)

If you want to test in mobile, first click menu Lua/Copy lua files to Resources. then build it

如果你想在手机上测试,首先点击菜单Lua/Copy lua files to Resources, 之后再build.

有bug 可以到QQ群反馈: 286510803. 不闲聊,非bug相关不要加群, 请加讨论群: 434341400

#Library

Debugger
https://github.com/topameng/Debugger

tolua_runtime
https://github.com/topameng/tolua_runtime

#FrameWork and Demo LuaFrameWork
https://github.com/jarjin/LuaFramework_NGUI
https://github.com/jarjin/LuaFramework_UGUI
XlsxToLua
https://github.com/zhangqi-ulua/XlsxToLua
UnityHello
https://github.com/woshihuo12/UnityHello
UWA-ToLua
http://uwa-download.oss-cn-beijing.aliyuncs.com/plugins%2FiOS%2FUWA-iOS-ToLua.zip

#Packages  Basics        Math      Data Structures
 luabitop       Quaternion       list
  struct         Vector3        event
  int64          Vector4        slot
  Time          Vector2
Networking        Ray
 luasocket         Color
 Parsing        Bounds
 lpeg             Mathf
 Protol           Touch
 pblua          RaycastHit
#关于反射 tolua# 不支持动态反射,对于重载函数有参数匹配问题,函数排序问题,ref ,out 参数问题等等,这样动态反射会有各种问题。
tolua#提供的替换方法是:

  1. preloading, 把你未来可能需要的类型添加到导出列表customTypeList,同时也添加到dynamicList列表中,这样导出后该类型并不会随binder注册到lua中,你可以通过 require "namespace.classname" 动态注册到lua中,对于非枚举类型tolua#系统也可以在第一次push该类型时动态载入,当然也可在过场动画、资源下载、登录、场景加载或者某个的函数中require这个类型。
  2. 1.0.5 版本开始加入静态反射,参考例子22。通过静态反射支持精确的函数参数匹配和类型检查。不会存在重载函数参数混乱匹配错误问题   #Performance | 平台 | 属性读写 | 函数调用 | Vector3构造 |GameObject构造|Vector3归一化|Slerp| | :-- | :-----------:|:---------:| :---------: |:-----------: |:----------: |:--: | | PC | 0.0465:0.15 | 0.076:0.19|0.02:0.001 |0.1:0.14 |0.014:0.001 |0.10:0.11| | Android | 0.26:1.03 | 0.39:1.15 |0.2:0.0049 |0.43:0.5 |0.27:0.02 |0.49:0.16| | iOS | 待测 | 待测 | 待测 |待测 |待测 | 待测|

测试结果为C#:Lua. 环境不同会略有差异。可用数字倍率做参考, 加了peer表略降了些
PC: Intel(R) Core(TM) i5-4590 [email protected] + 8GB + 64 位win7
Android: 中兴nubia z9 max(NX512J) + Adnroid5.0.2
#Examples 参考包内1-20例子

#About Lua win, android using luajit2.0.4. macos using luac(for u5.x). ios using luajit2.1-beta2

tolua's People

Contributors

topameng avatar castleyoung avatar radiobear avatar newbiegamecoder avatar bwb0101 avatar ialex32x avatar tangzx avatar woshihuo12 avatar

Stargazers

plateface avatar

Watchers

James Cloos avatar plateface avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.