Skip to content

[Unity]error when loading(sometime) #563

@DOSexample

Description

@DOSexample

init.js:24: SyntaxError: Unexpected token '.'

SyntaxError: Unexpected token '.'
Puerts.JsEnv.Eval (System.String chunk, System.String chunkName) (at Assets/TS/Puerts/Src/JsEnv.cs:210)
Puerts.JsEnv.ExecuteFile (System.String filename) (at Assets/TS/Puerts/Src/JsEnv.cs:193)
Puerts.JsEnv..ctor

PuertsDLL.cs
old

#if PUERTS_GENERAL && !PUERTS_GENERAL_OSX
        [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
        public static extern IntPtr Eval(IntPtr isolate, byte[] code, string path);

        public static IntPtr EvalChecked(IntPtr isolate, string code, string path)
        {
            if (code == null)
            {
                throw new InvalidProgramException("eval null string");
            }
            return Eval(isolate, Encoding.UTF8.GetBytes(code), path);
        }
#else

new

#if PUERTS_GENERAL && !PUERTS_GENERAL_OSX
        [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)]
        public static extern IntPtr Eval(IntPtr isolate, byte[] code, string path);

        public static IntPtr EvalChecked(IntPtr isolate, string code, string path)
        {
            if (code == null)
            {
                throw new InvalidProgramException("eval null string");
            }
            System.Collections.Generic.List<byte> bufferTemp = new System.Collections.Generic.List<byte>( Encoding.UTF8.GetBytes(code) );
bufferTemp.Add(0);//last byte of const char*
            return Eval(isolate, bufferTemp , path);
        }
#else

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions