y-lohse / inkjs

A javascript port of inkle's ink scripting language.
http://www.inklestudios.com/ink/
MIT License
507 stars 104 forks source link

Unable to pass symbols to `EvaluateFunction()` #1088

Open acolchagoff opened 6 days ago

acolchagoff commented 6 days ago

Describe the bug

I have an inventory list in ink that has a corresponding set of metadata functions: print_name and print_desc

To Reproduce

declare the following in ink:

=== function print_name(x)
{x:
    - pendant: Silver Pendant
}

=== function print_desc(x)
{x:
    - pendant: A brilliantly shiny silver pendant depicting the dove of Genos.
}

when running the following:

        const itemName = story.EvaluateFunction('print_name', [Symbol(item)]);
        const itemDescription = story.EvaluateFunction('print_desc', [Symbol(item)])

I get this error: Uncaught (in promise) Error: null

Expected behavior

ItemName and itemDescription will be set to the string values declared in ink

Ink files

N/A see examples above

Environment

Additional context

I posted this before: https://github.com/y-lohse/inkjs/issues/1020 I was unable to find anything that worked in the discord links