public static int InverseTransformPoint(IntPtr L) { int result = 1; int count = LuaDLL.lua_gettop(L); if (count == 2 && LuaStatic.CheckType(L, typeof(UnityEngine.Vector3), 2)) { UnityEngine.Transform obj = LuaStatic.GetObj(L, 1) as UnityEngine.Transform; UnityEngine.Vector3 arg1 = (UnityEngine.Vector3)LuaStatic.GetObj(L, 2); LuaDLL.lua_pushvector3(L, obj.InverseTransformPoint(arg1)); return(result); } if (count == 4 && LuaStatic.CheckType(L, typeof(Single), 2) && LuaStatic.CheckType(L, typeof(Single), 3) && LuaStatic.CheckType(L, typeof(Single), 4)) { UnityEngine.Transform obj = LuaStatic.GetObj(L, 1) as UnityEngine.Transform; Single arg1 = (Single)(double)(LuaStatic.GetObj(L, 2)); Single arg2 = (Single)(double)(LuaStatic.GetObj(L, 3)); Single arg3 = (Single)(double)(LuaStatic.GetObj(L, 4)); LuaDLL.lua_pushvector3(L, obj.InverseTransformPoint(arg1, arg2, arg3)); return(result); } LuaStatic.traceback(L, "count not enough"); LuaDLL.lua_error(L); return(result); }
public static int SetParent(IntPtr L) { int result = 1; int count = LuaDLL.lua_gettop(L); if (count == 2 && LuaStatic.CheckType(L, typeof(UnityEngine.Transform), 2)) { UnityEngine.Transform obj = LuaStatic.GetObj(L, 1) as UnityEngine.Transform; UnityEngine.Transform arg1 = (UnityEngine.Transform)LuaStatic.GetObj(L, 2); obj.SetParent(arg1); return(result); } if (count == 3 && LuaStatic.CheckType(L, typeof(UnityEngine.Transform), 2) && LuaStatic.CheckType(L, typeof(Boolean), 3)) { UnityEngine.Transform obj = LuaStatic.GetObj(L, 1) as UnityEngine.Transform; UnityEngine.Transform arg1 = (UnityEngine.Transform)LuaStatic.GetObj(L, 2); Boolean arg2 = (Boolean)LuaStatic.GetObj(L, 3); obj.SetParent(arg1, arg2); return(result); } LuaStatic.traceback(L, "count not enough"); LuaDLL.lua_error(L); return(result); }
public static int loader(IntPtr L) { string fileName = String.Empty; fileName = LuaDLL.lua_tostring(L, 1); fileName = fileName.Replace('.', '/'); fileName += ".lua"; byte[] text = Load(fileName); if (text == null) { LuaDLL.lua_pushstring(L, "loader failed to read file with path: " + fileName); LuaDLL.lua_error(L); return(0); } // 0: no errors; // LUA_ERRSYNTAX: syntax error during pre-compilation; // LUA_ERRMEM: memory allocation error. if (LuaDLL.luaL_loadbuffer(L, text, text.Length, fileName) != 0) { // loadbuffer会在栈顶压入错误信息,弹出错误信息所在的最上层栈 //LuaDLL.lua_pop(L, 1); LuaDLL.lua_error(L); HobaDebuger.LogErrorFormat("Failed to call luaL_loadbuffer, file: {0}", fileName); return(0); } return(1); }
public static void luaL_error(IntPtr luaState, string message) { LuaDLL.luaL_where(luaState, 1); LuaDLL.lua_pushstring(luaState, message); LuaDLL.lua_concat(luaState, 2); LuaDLL.lua_error(luaState); }
public static int GetComponent(IntPtr L) { int result = 1; int count = LuaDLL.lua_gettop(L); if (count == 2 && LuaStatic.CheckType(L, typeof(Type), 2)) { UnityEngine.GameObject obj = LuaStatic.GetObj(L, 1) as UnityEngine.GameObject; object type1 = LuaStatic.GetObj(L, 2); Type arg1 = LuaStatic.GetType(type1); LuaStatic.addGameObject2Lua(L, obj.GetComponent(arg1), (string)type1); return(result); } if (count == 2 && LuaStatic.CheckType(L, typeof(String), 2)) { UnityEngine.GameObject obj = LuaStatic.GetObj(L, 1) as UnityEngine.GameObject; String arg1 = (String)LuaStatic.GetObj(L, 2); LuaStatic.addGameObject2Lua(L, obj.GetComponent(arg1), "Component"); return(result); } LuaStatic.traceback(L, "count not enough"); LuaDLL.lua_error(L); return(result); }
public static int IsInvoking(IntPtr L) { int result = 1; int count = LuaDLL.lua_gettop(L); if (count == 2 && LuaStatic.CheckType(L, typeof(String), 2)) { UnityEngine.MonoBehaviour obj = LuaStatic.GetObj(L, 1) as UnityEngine.MonoBehaviour; String arg1 = (String)LuaStatic.GetObj(L, 2); LuaDLL.lua_pushboolean(L, obj.IsInvoking(arg1)); return(result); } if (count == 1) { UnityEngine.MonoBehaviour obj = LuaStatic.GetObj(L, 1) as UnityEngine.MonoBehaviour; LuaDLL.lua_pushboolean(L, obj.IsInvoking()); return(result); } LuaStatic.traceback(L, "count not enough"); LuaDLL.lua_error(L); return(result); }
public static int New(IntPtr L) { int result = 1; int count = LuaDLL.lua_gettop(L); if (count == 2 && LuaStatic.CheckType(L, typeof(String), 2)) { String arg1 = (String)LuaStatic.GetObj(L, 2); LuaStatic.addGameObject2Lua(L, new UnityEngine.GameObject(arg1), "GameObject"); return(result); } if (count == 1) { LuaStatic.addGameObject2Lua(L, new UnityEngine.GameObject(), "GameObject"); return(result); } if (count == 3 && LuaStatic.CheckType(L, typeof(String), 2) && LuaStatic.CheckType(L, typeof(Type[]), 3)) { String arg1 = (String)LuaStatic.GetObj(L, 2); Type[] arg2 = (Type[])LuaStatic.GetObj(L, 3); LuaStatic.addGameObject2Lua(L, new UnityEngine.GameObject(arg1, arg2), "GameObject"); return(result); } LuaStatic.traceback(L, "count not enough"); LuaDLL.lua_error(L); return(result); }
public static int dofile(IntPtr L) { int n = LuaDLL.lua_gettop(L); if (0 == n) { LuaDLL.lua_pushstring(L, "dofile function - 1 param expected, got 0"); LuaDLL.lua_error(L); return(0); } String filePath; bool bLoaded = (loadfileFromAssetsPath(L, out filePath) == 0); if (!bLoaded) { //loadfileFromAssetsPath 已准备好error信息 LuaDLL.lua_error(L); return(0); } LuaDLL.lua_call(L, 0, LuaDLL.LUA_MULTRET); return(LuaDLL.lua_gettop(L)); }
public static int Destroy(IntPtr L) { int result = 1; int count = LuaDLL.lua_gettop(L); if (count == 3 && LuaStatic.CheckType(L, typeof(UnityEngine.Object), 2) && LuaStatic.CheckType(L, typeof(Single), 3)) { UnityEngine.Object arg1 = (UnityEngine.Object)LuaStatic.GetObj(L, 2); Single arg2 = (Single)(double)(LuaStatic.GetObj(L, 3)); UnityEngine.Object.Destroy(arg1, arg2); return(result); } if (count == 2 && LuaStatic.CheckType(L, typeof(UnityEngine.Object), 2)) { UnityEngine.Object arg1 = (UnityEngine.Object)LuaStatic.GetObj(L, 2); UnityEngine.Object.Destroy(arg1); return(result); } LuaStatic.traceback(L, "count not enough"); LuaDLL.lua_error(L); return(result); }
public static int LoadAsync(IntPtr L) { int result = 1; int count = LuaDLL.lua_gettop(L); if (count == 2 && LuaStatic.CheckType(L, typeof(String), 2)) { String arg1 = (String)LuaStatic.GetObj(L, 2); LuaStatic.addGameObject2Lua(L, UnityEngine.Resources.LoadAsync(arg1), "ResourceRequest"); return(result); } if (count == 3 && LuaStatic.CheckType(L, typeof(String), 2) && LuaStatic.CheckType(L, typeof(Type), 3)) { String arg1 = (String)LuaStatic.GetObj(L, 2); object type2 = LuaStatic.GetObj(L, 3); Type arg2 = LuaStatic.GetType(type2); LuaStatic.addGameObject2Lua(L, UnityEngine.Resources.LoadAsync(arg1, arg2), (string)type2); return(result); } LuaStatic.traceback(L, "count not enough"); LuaDLL.lua_error(L); return(result); }
public static int CloseView(IntPtr L) { int result = 1; int count = LuaDLL.lua_gettop(L); if (count == 2 && LuaStatic.CheckType(L, typeof(EnumUIName), 2)) { UIManager obj = LuaStatic.GetObj(L, 1) as UIManager; EnumUIName arg1 = (EnumUIName)(double)(LuaStatic.GetObj(L, 2)); obj.CloseView(arg1); return(result); } if (count == 3 && LuaStatic.CheckType(L, typeof(EnumUIName), 2) && LuaStatic.CheckType(L, typeof(Boolean), 3)) { UIManager obj = LuaStatic.GetObj(L, 1) as UIManager; EnumUIName arg1 = (EnumUIName)(double)(LuaStatic.GetObj(L, 2)); Boolean arg2 = (Boolean)LuaStatic.GetObj(L, 3); obj.CloseView(arg1, arg2); return(result); } LuaStatic.traceback(L, "count not enough"); LuaDLL.lua_error(L); return(result); }
/* * Calls the object as a function with the provided arguments and * casting returned values to the types in returnTypes before returning * them in an array */ internal object[] callFunction(LuaFunction function, object[] args, Type[] returnTypes) { int nArgs = 0; int oldTop = LuaDLL.lua_gettop(luaState); if (!LuaDLL.lua_checkstack(luaState, args.Length + 6)) { throw new LuaException("Lua stack overflow"); } translator.push(luaState, function); if (args != null) { nArgs = args.Length; for (int i = 0; i < args.Length; i++) { translator.push(luaState, args[i]); } } int error = LuaDLL.lua_pcall(luaState, nArgs, -1, 0); if (error != 0) { LuaDLL.lua_error(luaState); } return(translator.popValues(luaState, oldTop, returnTypes)); }
public static int BroadcastMessage(IntPtr L) { int result = 1; int count = LuaDLL.lua_gettop(L); if (count == 4 && LuaStatic.CheckType(L, typeof(String), 2) && LuaStatic.CheckType(L, typeof(Object), 3) && LuaStatic.CheckType(L, typeof(UnityEngine.SendMessageOptions), 4)) { UnityEngine.GameObject obj = LuaStatic.GetObj(L, 1) as UnityEngine.GameObject; String arg1 = (String)LuaStatic.GetObj(L, 2); Object arg2 = (Object)LuaStatic.GetObj(L, 3); UnityEngine.SendMessageOptions arg3 = (UnityEngine.SendMessageOptions)(double)(LuaStatic.GetObj(L, 4)); obj.BroadcastMessage(arg1, arg2, arg3); return(result); } if (count == 3 && LuaStatic.CheckType(L, typeof(String), 2) && LuaStatic.CheckType(L, typeof(Object), 3)) { UnityEngine.GameObject obj = LuaStatic.GetObj(L, 1) as UnityEngine.GameObject; String arg1 = (String)LuaStatic.GetObj(L, 2); Object arg2 = (Object)LuaStatic.GetObj(L, 3); obj.BroadcastMessage(arg1, arg2); return(result); } if (count == 2 && LuaStatic.CheckType(L, typeof(String), 2)) { UnityEngine.GameObject obj = LuaStatic.GetObj(L, 1) as UnityEngine.GameObject; String arg1 = (String)LuaStatic.GetObj(L, 2); obj.BroadcastMessage(arg1); return(result); } if (count == 3 && LuaStatic.CheckType(L, typeof(String), 2) && LuaStatic.CheckType(L, typeof(UnityEngine.SendMessageOptions), 3)) { UnityEngine.GameObject obj = LuaStatic.GetObj(L, 1) as UnityEngine.GameObject; String arg1 = (String)LuaStatic.GetObj(L, 2); UnityEngine.SendMessageOptions arg2 = (UnityEngine.SendMessageOptions)(double)(LuaStatic.GetObj(L, 3)); obj.BroadcastMessage(arg1, arg2); return(result); } LuaStatic.traceback(L, "count not enough"); LuaDLL.lua_error(L); return(result); }
public static int GetComponentsInParent(IntPtr L) { int result = 1; int count = LuaDLL.lua_gettop(L); if (count == 2 && LuaStatic.CheckType(L, typeof(Type), 2)) { UnityEngine.GameObject obj = LuaStatic.GetObj(L, 1) as UnityEngine.GameObject; object type1 = LuaStatic.GetObj(L, 2); Type arg1 = LuaStatic.GetType(type1); IEnumerable objs = (IEnumerable)obj.GetComponentsInParent(arg1); LuaDLL.lua_newtable(L); int num2 = 0; foreach (var item in objs) { LuaStatic.addGameObject2Lua(L, (UnityEngine.Component)item, (string)type1); LuaDLL.lua_pushnumber(L, (double)(++num2)); LuaDLL.lua_insert(L, -2); LuaDLL.lua_settable(L, -3); } return(result); } if (count == 3 && LuaStatic.CheckType(L, typeof(Type), 2) && LuaStatic.CheckType(L, typeof(Boolean), 3)) { UnityEngine.GameObject obj = LuaStatic.GetObj(L, 1) as UnityEngine.GameObject; object type1 = LuaStatic.GetObj(L, 2); Type arg1 = LuaStatic.GetType(type1); Boolean arg2 = (Boolean)LuaStatic.GetObj(L, 3); IEnumerable objs = (IEnumerable)obj.GetComponentsInParent(arg1, arg2); LuaDLL.lua_newtable(L); int num2 = 0; foreach (var item in objs) { LuaStatic.addGameObject2Lua(L, (UnityEngine.Component)item, "Component"); LuaDLL.lua_pushnumber(L, (double)(++num2)); LuaDLL.lua_insert(L, -2); LuaDLL.lua_settable(L, -3); } return(result); } LuaStatic.traceback(L, "count not enough"); LuaDLL.lua_error(L); return(result); }
public static int GetSiblingIndex(IntPtr L) { int result = 1; int count = LuaDLL.lua_gettop(L); if (count != 1) { LuaStatic.traceback(L, "count not enough"); LuaDLL.lua_error(L); return(result); } UnityEngine.Transform obj = LuaStatic.GetObj(L, 1) as UnityEngine.Transform; LuaDLL.lua_pushnumber(L, obj.GetSiblingIndex()); return(result); }
public static int get_localToWorldMatrix(IntPtr L) { int result = 1; int count = LuaDLL.lua_gettop(L); if (count != 1) { LuaStatic.traceback(L, "count not enough"); LuaDLL.lua_error(L); return(result); } UnityEngine.Transform obj = LuaStatic.GetObj(L, 1) as UnityEngine.Transform; LuaStatic.addGameObject2Lua(L, obj.localToWorldMatrix, "Matrix4x4"); return(result); }
public static int GetInstanceID(IntPtr L) { int result = 1; int count = LuaDLL.lua_gettop(L); if (count != 1) { LuaStatic.traceback(L, "count not enough"); LuaDLL.lua_error(L); return(result); } UnityEngine.Object obj = LuaStatic.GetObj(L, 1) as UnityEngine.Object; LuaDLL.lua_pushnumber(L, obj.GetInstanceID()); return(result); }
public static int get_transform(IntPtr L) { int result = 1; int count = LuaDLL.lua_gettop(L); if (count != 1) { LuaStatic.traceback(L, "count not enough"); LuaDLL.lua_error(L); return(result); } UnityEngine.Component obj = LuaStatic.GetObj(L, 1) as UnityEngine.Component; LuaStatic.addGameObject2Lua(L, obj.transform, "Transform"); return(result); }
public static int get_forward(IntPtr L) { int result = 1; int count = LuaDLL.lua_gettop(L); if (count != 1) { LuaStatic.traceback(L, "count not enough"); LuaDLL.lua_error(L); return(result); } UnityEngine.Transform obj = LuaStatic.GetObj(L, 1) as UnityEngine.Transform; LuaDLL.lua_pushvector3(L, obj.forward); return(result); }
public static int GetEnumerator(IntPtr L) { int result = 1; int count = LuaDLL.lua_gettop(L); if (count != 1) { LuaStatic.traceback(L, "count not enough"); LuaDLL.lua_error(L); return(result); } UnityEngine.Transform obj = LuaStatic.GetObj(L, 1) as UnityEngine.Transform; LuaStatic.addGameObject2Lua(L, obj.GetEnumerator(), "IEnumerator"); return(result); }
public static int get_rotation(IntPtr L) { int result = 1; int count = LuaDLL.lua_gettop(L); if (count != 1) { LuaStatic.traceback(L, "count not enough"); LuaDLL.lua_error(L); return(result); } UnityEngine.Transform obj = LuaStatic.GetObj(L, 1) as UnityEngine.Transform; LuaStatic.addGameObject2Lua(L, obj.rotation, "Quaternion"); return(result); }
public static int get_useGUILayout(IntPtr L) { int result = 1; int count = LuaDLL.lua_gettop(L); if (count != 1) { LuaStatic.traceback(L, "count not enough"); LuaDLL.lua_error(L); return(result); } UnityEngine.MonoBehaviour obj = LuaStatic.GetObj(L, 1) as UnityEngine.MonoBehaviour; LuaDLL.lua_pushboolean(L, obj.useGUILayout); return(result); }
public static int SetAsLastSibling(IntPtr L) { int result = 1; int count = LuaDLL.lua_gettop(L); if (count != 1) { LuaStatic.traceback(L, "count not enough"); LuaDLL.lua_error(L); return(result); } UnityEngine.Transform obj = LuaStatic.GetObj(L, 1) as UnityEngine.Transform; obj.SetAsLastSibling(); return(result); }
public static int get_gameObject(IntPtr L) { int result = 1; int count = LuaDLL.lua_gettop(L); if (count != 1) { LuaStatic.traceback(L, "count not enough"); LuaDLL.lua_error(L); return(result); } UnityEngine.GameObject obj = LuaStatic.GetObj(L, 1) as UnityEngine.GameObject; LuaStatic.addGameObject2Lua(L, obj.gameObject, "GameObject"); return(result); }
public static int StopAllCoroutines(IntPtr L) { int result = 1; int count = LuaDLL.lua_gettop(L); if (count != 1) { LuaStatic.traceback(L, "count not enough"); LuaDLL.lua_error(L); return(result); } UnityEngine.MonoBehaviour obj = LuaStatic.GetObj(L, 1) as UnityEngine.MonoBehaviour; obj.StopAllCoroutines(); return(result); }
public static int get_tag(IntPtr L) { int result = 1; int count = LuaDLL.lua_gettop(L); if (count != 1) { LuaStatic.traceback(L, "count not enough"); LuaDLL.lua_error(L); return(result); } UnityEngine.GameObject obj = LuaStatic.GetObj(L, 1) as UnityEngine.GameObject; LuaDLL.lua_pushstring(L, obj.tag); return(result); }
public static int get_activeInHierarchy(IntPtr L) { int result = 1; int count = LuaDLL.lua_gettop(L); if (count != 1) { LuaStatic.traceback(L, "count not enough"); LuaDLL.lua_error(L); return(result); } UnityEngine.GameObject obj = LuaStatic.GetObj(L, 1) as UnityEngine.GameObject; LuaDLL.lua_pushboolean(L, obj.activeInHierarchy); return(result); }
public static int set_tag(IntPtr L) { int result = 1; int count = LuaDLL.lua_gettop(L); if (count != 2) { LuaStatic.traceback(L, "count not enough"); LuaDLL.lua_error(L); return(result); } UnityEngine.Component obj = LuaStatic.GetObj(L, 1) as UnityEngine.Component; obj.tag = (String)LuaStatic.GetObj(L, 2); return(result); }
public static int set_isStatic(IntPtr L) { int result = 1; int count = LuaDLL.lua_gettop(L); if (count != 2) { LuaStatic.traceback(L, "count not enough"); LuaDLL.lua_error(L); return(result); } UnityEngine.GameObject obj = LuaStatic.GetObj(L, 1) as UnityEngine.GameObject; obj.isStatic = (Boolean)LuaStatic.GetObj(L, 2); return(result); }
public static int set_hideFlags(IntPtr L) { int result = 1; int count = LuaDLL.lua_gettop(L); if (count != 2) { LuaStatic.traceback(L, "count not enough"); LuaDLL.lua_error(L); return(result); } UnityEngine.Object obj = LuaStatic.GetObj(L, 1) as UnityEngine.Object; obj.hideFlags = (UnityEngine.HideFlags)LuaStatic.GetObj(L, 2); return(result); }