Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object function parameter with a text default value causes severe error #2353

Closed
ItzAtomikHD opened this issue Aug 7, 2019 · 2 comments
Closed
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. completed The issue has been fully resolved and the change will be in the next Skript update. priority: medium Issues that are detrimental to user experience (prohibitive bugs or lack of useful implementation).

Comments

@ItzAtomikHD
Copy link

Description

If you create a function with a parameter of type object and you want to give it a default value of a string, it causes an error.

Steps to Reproduce

Create a function with a parameter type object and a default value of a string.

function blah(s: object = "") :: text:
	return "%{_s}%"
	
command /test:
	trigger:
		set {_default} to blah()
		set {_custom} to blah("hey")
		broadcast {_default}
		broadcast {_custom}

Expected Behavior

The default value to be applied when no parameter is passed.

Errors / Screenshots

An error is thrown from Skript, but only when no parameter is passed.
https://gist.github.com/ItzAtomikHD/53307190bb80120bcc4316827892b0d8

Server Information

  • Server version/platform: Spigot 1.14.4-R0.1-SNAPSHOT
  • Skript version: 2.4-beta5
@ItzAtomikHD ItzAtomikHD changed the title Object function parameter errors with a text default value Object function parameter with a text default value causes severe error Aug 7, 2019
@Matocolotoe
Copy link
Contributor

This is because the object specified as a default value must be serialized to an actual string before. They fixed it for function parameters but not for default values like this.

@TheBentoBox TheBentoBox added bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. priority: medium Issues that are detrimental to user experience (prohibitive bugs or lack of useful implementation). labels Aug 26, 2019
@TheBentoBox
Copy link
Member

This breaks a realistic use case of functions.

@bensku bensku added the completed The issue has been fully resolved and the change will be in the next Skript update. label Aug 31, 2019
@bensku bensku closed this as completed Sep 3, 2019
bensku added a commit that referenced this issue Sep 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. completed The issue has been fully resolved and the change will be in the next Skript update. priority: medium Issues that are detrimental to user experience (prohibitive bugs or lack of useful implementation).
Projects
None yet
Development

No branches or pull requests

4 participants