Lua Error threw exception
- Stalker_EG
- Posts: 31
- Joined: Sun Jul 07, 2019 7:57 pm
Lua Error threw exception
Good afternoon.
When trying to execute lua code:
Actor["Dan"].Dan/main/satiety = 0
get this error:
Dialogue System: Lua code 'Actor["Dan"].Dan/main/satiety = 0' threw exception 'Code has syntax errors:
Line 2, Col 1 : Failed to parse Letter of Name.
Line 2, Col 1 : Failed to parse Name of VarName.
Line 2, Col 1 : Failed to parse 'nil' of NilLiteral.
Line 2, Col 1 : Failed to parse Text of BoolLiteral.
Line 2, Col 1 : Failed to parse '0'...'9' of Digit.
Line 2, Col 1 : Failed to parse (Digit)+ of FloatNumber.
What am I doing wrong? The code is compiled by a wizard inside the dialog editor.
When trying to execute lua code:
Actor["Dan"].Dan/main/satiety = 0
get this error:
Dialogue System: Lua code 'Actor["Dan"].Dan/main/satiety = 0' threw exception 'Code has syntax errors:
Line 2, Col 1 : Failed to parse Letter of Name.
Line 2, Col 1 : Failed to parse Name of VarName.
Line 2, Col 1 : Failed to parse 'nil' of NilLiteral.
Line 2, Col 1 : Failed to parse Text of BoolLiteral.
Line 2, Col 1 : Failed to parse '0'...'9' of Digit.
Line 2, Col 1 : Failed to parse (Digit)+ of FloatNumber.
What am I doing wrong? The code is compiled by a wizard inside the dialog editor.
Re: Lua Error threw exception
Hi,
The Dialogue System doesn't currently handle forward slashes ( / ) in custom field names. I'll add support for this into the next update.
The Dialogue System doesn't currently handle forward slashes ( / ) in custom field names. I'll add support for this into the next update.
- Stalker_EG
- Posts: 31
- Joined: Sun Jul 07, 2019 7:57 pm
Re: Lua Error threw exception
Tell me, how can we get out of this situation now?? change all the variables?
It's just that the description says "/" is supported everywhere for the convenience of the structure.
I could not even think that Lua does not support it. I have all the variables in all the tables so grouped.
It's just that the description says "/" is supported everywhere for the convenience of the structure.
I could not even think that Lua does not support it. I have all the variables in all the tables so grouped.
Re: Lua Error threw exception
I'll send you a patch later today
- Stalker_EG
- Posts: 31
- Joined: Sun Jul 07, 2019 7:57 pm
Re: Lua Error threw exception
Oh, this is gonna be awesome! I've already broken my head about how to get out of this situation.
I'm sorry I must have loaded you with work. But I really couldn't imagine that this format wasn't supported. I'm sorry. I'm looking forward to that patch. Thank you so much for that level of support.
I'm sorry I must have loaded you with work. But I really couldn't imagine that this format wasn't supported. I'm sorry. I'm looking forward to that patch. Thank you so much for that level of support.
Re: Lua Error threw exception
Hi,
Here's the patch:
DialogueSystem_2_2_4_Patch20200105.unitypackage
At runtime, fields with forward slashes such as "Dan/main/satiety" will use underscores in Lua such as "Dan_main_satiety". You do not need to change the field name in the Actors section. When you use the "..." wizard to generate new Conditions and Script expressions, they will now be correctly generated as:
However, you will need to update any existing Conditions and Script fields. Here are some ways to do this:
1. Manually edit the Conditions or Script field and replace "/" with "_".
2. Or delete the old expression and use "..." to generate it again.
3. Or use the Database section's Global Search & Replace feature. Replace ".Dan/main/satiety" with ".Dan_main_satiety". NOTE: The "." in front is very important. Otherwise it will also replace the actual field name in the Actors section, which you do not want to do.
Here's the patch:
DialogueSystem_2_2_4_Patch20200105.unitypackage
At runtime, fields with forward slashes such as "Dan/main/satiety" will use underscores in Lua such as "Dan_main_satiety". You do not need to change the field name in the Actors section. When you use the "..." wizard to generate new Conditions and Script expressions, they will now be correctly generated as:
Code: Select all
Actor["Dan"].Dan_main_satiety = 0
1. Manually edit the Conditions or Script field and replace "/" with "_".
2. Or delete the old expression and use "..." to generate it again.
3. Or use the Database section's Global Search & Replace feature. Replace ".Dan/main/satiety" with ".Dan_main_satiety". NOTE: The "." in front is very important. Otherwise it will also replace the actual field name in the Actors section, which you do not want to do.
- Stalker_EG
- Posts: 31
- Joined: Sun Jul 07, 2019 7:57 pm
Re: Lua Error threw exception
Thank you again so much for your support! I'm going to check it out and let you know the result.
- Stalker_EG
- Posts: 31
- Joined: Sun Jul 07, 2019 7:57 pm
Re: Lua Error threw exception
works! It's perfect.
I hope that doesn't change in the next update?
Thank you so much!
I hope that doesn't change in the next update?
Thank you so much!
Re: Lua Error threw exception
This same fix will also be in the next version.