Exemple #1
0
    static LuaApi GetClassApi(string name, string inherits = null)
    {
        LuaApi api;

        if (s_apiIdx.TryGetValue(name, out api))
        {
            if (api.inherits == null && inherits != null)
            {
                api.inherits = inherits;
            }
            return(api);
        }

        LuaApi parent = s_api;
        //先获取父命名空间
        int at = name.LastIndexOf('.');

        if (at != -1)
        {
            parent = GetClassApi(name.Substring(0, at));
        }

        api            = parent.AddClass(at != -1 ? name.Substring(at + 1) : name, inherits);
        s_apiIdx[name] = api;
        return(api);
    }