Exemple #1
0
        private void CreateScripFunction(LuaFunction func, int dpth = 0, string name = "", bool isGlobal = false)
        {
            // TODO: write functions on CLOSURE and not each list?
            string funcName = "";

            if (dpth == 0)       // unused?
            {
                funcName = null; // destroy header on root
            }
            if (funcName != null)
            {
                funcName = name; // TODO: remp fix, cleanup soonTM
            }
            LuaScriptFunction newFunction = new LuaScriptFunction(funcName, func.ArgsCount, ref func, ref this.Decoder);

            this.LuaFunctions.Add(newFunction);
            // TODO: move the above into a LuaScriptHeader or smthing

            for (int i = 0; i < func.Instructions.Count; i++)
            {
                newFunction.Lines.Add(new LuaScriptLine(func.Instructions[i], ref this.Decoder, ref func)
                {
                    Number = i,
                    Depth  = dpth + 1
                });
            }
        }
Exemple #2
0
        private void CreateScripFunction(LuaFunction func, int dpth = 0, bool isGlobal = false)
        {
            LuaScriptFunction newFunction = new LuaScriptFunction(func, this.Decoder);

            this.LuaFunctions.Add(newFunction);
            // TODO: move the above into a LuaScriptHeader or smthing

            for (int i = 0; i < func.Instructions.Count; i++)
            {
                newFunction.GetLines().Add(new LuaScriptLine(func.Instructions[i], this.Decoder, func)
                {
                    Number = i,
                    Depth  = dpth + 1
                });
            }
            newFunction.Complete();
        }