Skip to content

Passing C# field through javascript and back into C# results in null #87

@ghost

Description

Here is my setup:

I plan to use JavaScript as the language for modding my game, I currently have it setup to create a javascript context with 3 variables: log, mod and require, require isn't being used yet...

mod is a C# object with the field I am trying to use.
log is also a C# object with functions that redirect to log4net, (mainly info(string format, object[] objs))

Here is the issue, in my javascript file I have:

log.info("Hello from {0}!", [mod.display_name]);

Which results in:

Hello from !

Even though mod's C# object has the field display_name set to "sandbox"
I even checked with the debugger, the C# instance of mod is correct, I debugged the C# function for log.info and noticed that mod.display_name was evaluating to null before being passed through the function. Why is this happening? And how can I fix it?

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