static int AddComponent(IntPtr L) { try { UnityEngine.GameObject self = LuaExtend.GetObject(L, 1) as UnityEngine.GameObject; if (self == null) { throw new LuaException(L, "Object is null"); } string component = LuaDLL.lua_tostring(L, 2); ComponentMethodDelegate func = null; if (typesAdd.TryGetValue(component, out func)) { UnityEngine.Component com = func(self); LuaExtend.AddObject2Lua(L, com, null); } else { throw new LuaException(L, "Component is not registed:" + component); } return(1); } catch (Exception e) { return(LuaDLL.wluaL_error(L, e)); } }
static int CreatePrimitive(IntPtr L) { try { PrimitiveType type = (PrimitiveType)LuaDLL.lua_tointeger(L, 1); GameObject go = UnityEngine.GameObject.CreatePrimitive(type); LuaExtend.AddObject2Lua(L, go, null); return(1); } catch (Exception e) { return(LuaDLL.wluaL_error(L, e)); } }
static int GameObject(IntPtr L) { try { System.String param0 = default(System.String); param0 = LuaDLL.lua_tostring(L, 1); UnityEngine.GameObject ret = new UnityEngine.GameObject( param0 ); LuaExtend.AddObject2Lua(L, ret, null); return(1); } catch (Exception e) { return(LuaDLL.wluaL_error(L, e)); } }