Idea about Lua Elements and Savin

  • DanDuncombe
    28th Jan 2014 Member 0 Permalink

    Ok, this is just an idea for TPT.

    Some people use lua to make custom elements, so:

    My suggestion is, make it maybe so that you can publically upload saves with custom lua elements, and if someone opens it that custom lua element gets created by putting the necessary code in a temporary lua file and then having it execute automatically. As well as this, players should have an option to locally save the lua element as well as the save, so that the element will be in the menus like normal elements.

    Just a little suggestion... Thanks if you do consider it!

  • therocketeer
    28th Jan 2014 Member 1 Permalink
    @DanDuncombe (View Post)
    What's to stop anyone from scripting a lua virus and distributing it through the save?
    That's why lua mods always show the source before running them..
  • boxmein
    28th Jan 2014 Former Staff 1 Permalink
    Well, in theory, if you poked me and cracker64 hard enough, I could redeploy my script server, which basically did host Lua scripts as well as special associations which would allow his mod loader to fetch the according scripts from that server by the save ID. :รต

    https://github.com/boxmein/tpt-script-server/
    Edited once by boxmein. Last: 28th Jan 2014
  • DanDuncombe
    28th Jan 2014 Member 0 Permalink

    @therocketeer (View Post)

     Well, the game will create a script to save with the element's properties. And with lua viruses, well, maybe saves with custom lua elements could have a little icon to show that they have custom elements, and may be dangerous. Maybe also, if your right-click on these saves, there will be an option to view the lua script that comes with the save.

     

    @boxmein (View Post)

    Combined with what I said above, that would be a nice possible idea, that in theory I suppose could increase the likelihood of this all becoming real. Thanks for pointing that server thingy out!

     

     

  • boxmein
    28th Jan 2014 Former Staff 1 Permalink
    @DanDuncombe (View Post)
    It's the only likely way of ever implementing this entirely without developer-side support.
  • CeeJayBee
    29th Jan 2014 Member 0 Permalink

    @boxmein @cracker64

     

    *ubahpoke*

  • jacob1
    29th Jan 2014 Developer 0 Permalink
    If we did this, it just needs a way to be moderated. You can do a lot of very harmful things just from one lua script, and if you know enough you can easily hide malicious things inside a seemingly harmless script. It is possible to create a lua sandbox, where all the harmful functions get removed. I've had it in my mod for a long time, and even though nobody really noticed, i'm sure it's safe. The only things you can still do are crash the game and cause horrible lag. So some moderation is still needed (also in case anyone finds a exploit). Probably if you published a save with a custom element, it wouldn't be really published until the script inside was approved by a moderator.

    If we are adding custom lua elements, including the lua scripts behind them, we are basically also adding the full ability to embed lua scripts in saves. Because I can easily make an element that adds hooks and loads cracker64's entire tpt multiplayer script, or similar. So we also have to think of the consequences of this, really we should just add the ability to embed any lua script in saves, elements are just one part of this.

    Adding lua scripts to saves is something that was planned long ago (See https://powdertoy.co.uk/Scripts.html). tpt even has a command in game to download and run a script from there, except nobody can add new scripts anyway. boxmein's is a lot more complete I think, but I've never really seen it to know how it works.

    In the end it might be too dangerous to allow people to mess with the game from scripts. I'm probably the dev that's most for it, I don't know what the others think. It needs a lot of server side changes to ever get done though, which means it probably can't ever be done.

    Edit: I'd also like the mention that if you have a custom lua element and make a save with it, anyone that loads the save that also has the script already on their computer will be able to open / use it.
    Edited 3 times by jacob1. Last: 29th Jan 2014
  • jenn4
    29th Jan 2014 Member 0 Permalink
    You could just make it so users can - while publishing a save - add a forum post ID. If post ID was given, the game gives anyone opening the save a pop-up dialog with a link to the forum thread, and a note about possible data on the post required for the save the function properly, couldn't you?
    Edited once by jenn4. Last: 29th Jan 2014
  • CeeJayBee
    30th Jan 2014 Member 0 Permalink

    Or you could just make a save with custom elements and put a {f:<forum id>|<text>} sign in.

  • boxmein
    30th Jan 2014 Former Staff 0 Permalink
    @jacob1 (View Post)
    >If we did this, it just needs a way to be moderated.
    tpt-script-server would be under my super dictatorish rule and as such no evil will pass through! I'll upload a few things and try to get something to host it, brb.

    @jacob1 (View Post)
    >Edit: I'd also like the mention that if you have a custom lua element and make a save with it, anyone that loads the save that also has the script already on their computer will be able to open / use it.

    woot! saves support it!