Jump to content

Revamp of editor Script Properties


Einlander
 Share

Recommended Posts

Currently to expose settings to the editor users have to use the format:

 


Script.variable = value --Type "Label"

 

I propose a breaking change to the way editor properties function.

 

First the syntax/method would need to change.

 

Script would become a table:


Script = {}

 

All entries would be become named variables holding tables:


Script = {

--variable = {value, "type as string","label as string"}

ground_height = {100, "uinteger","Ground Height" },

jump_height = {4,"uinteger", "Jump Height"},

player_name = {"","string", "Player Name"}

}

 

What this would mean is the editor would need to actually load the script itself, which brings a few drawbacks.

1. the entire script would need to be able to load without any errors.

2. if the script fails there is a chance that the properties will fail to load.

3. if the script property section is malformed or wrong it will not show up.

 

or just grab it from the debug info (i would assume it's rather hard)

 

A solution for this would be:

1. To hold a copy of the properties in memory/cache and restore them when the properties returns.

2. add a small reset button to reset the value to default. (since the editor will always be remembering the last value).

 

If this is implemented there is an additional benefit:


function Script:test1()

return {"Good","Neutral","Bad"}

end

 

Script = {

--variable = {value, "type as string","label as string"}

ground_height = {100, "uinteger","Ground Height" },

jump_height = {4,"uinteger", "Jump Height"},

player_name = {"","string", "Player Name"},

dynamic_list = {self:test1() ,"choice","Team"}

}

 

 

You can now dynamically populate lists!!

1 draw back is you would either need to forward declare functions or put the functions above the script declaration.

 

 

Even if this is not implemented, it could be useful if editor plugins are ever added.

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...