Example #1
0
        public void Len(int idx)
        {
            var val = stack.get(idx);

            if (LuaValue.isString(val))
            {
                var s = LuaValue.toString(val);
                stack.push((long)s.Length);
            }
            else if (LuaValue.isLuaTable(val))
            {
                var t = LuaValue.toLuaTable(val);
                stack.push((long)t.len());
            }
            else
            {
                throw new Exception("length error!");
            }
        }