Noita
Not enough ratings
Copi's Twitchy Lua
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
6.729 KB
18 Feb, 2023 @ 8:26am
28 Feb @ 10:53pm
2 Change Notes ( view )

Subscribe to download
Copi's Twitchy Lua

In 1 collection by Copi
Copi's "Stuff"
23 items
Description




Run code straight from twitch chat! In real time, within the safe API, this mod allows you to run code.

As twitch has bad formatting, you must write your code on one single line, but fear not!
In Lua, you can separate lines with a semicolon (;) or write multiple lines to a file and call the file later.

Messages starting with
LUA:
will be treated like code, with the
LUA:
bit removed. Example code:
LUA: ThisIsAFunction(2, 5);IAmAFunctionOnAnotherLine() --this is line 2;

Attributions and Thanks
  • Dextercd
    • Allowing this mod to exist, with excellent knowledge of Lua and endless support.
  • NathanSkimScam
    • Presenting a solution to the mod's biggest flaw
  • Horscht
    • Pointing me to a function which made detecting errors easy.
  • Bruham
    • Inspiring the mod, and modding tricks used in prior versions of the mod

Mod Settings
  • Power User(s)
    • Unless pandemonium is enabled, only the Power User many run code.
    • Must match the twitch username of the user.
    • Space separated list (e.g. CopiHuman Conga_Lyne).
  • Pandemonium
    • Allows anyone to run code.
    • Possibly risky. Use with care.
  • Chaos
    • Disables protections on all functions.
    • VERY DANGEROUS. Use with care.

Preset Variables
  • Player
    • Returns a reference to the first player entity
  • Px, Py, Pr, Psx, Psy
    • Returns the transform data of the first player entity
  • Mx, My
    • Returns the cursor position
  • Cx, Cy
    • Returns the camera position
  • Ploop(func)
    • Iterates over all players, executing func(player) on them
  • Comp
    • EntityGetFirstComponentIncludingDisabled

Warnings
Even I don't know the full extent of this mod's capabilities, and I take no responsibility for any damages done with it.
I, Copi, and anyone else affiliated with this project are not responsible for your misuse of this mod. Beware of malicious users!



[discord.gg]

4 Comments
Copi  [author] 11 Nov, 2024 @ 5:32pm 
Also it's somewhat of a tech demo just to show that this is possible, since I figured you can pass data into the game over twitch, and that you can run code passed in at runtime, so combined with some help from some talented devs this exists
Copi  [author] 11 Nov, 2024 @ 5:31pm 
as userk said, yeah there's only so much I can do, but whatever this mod can do is no worse than any other mod. As long as you trust whoever the power user is, this is actually safer than a workshop mod due to safeguards put in place (disabled by the Chaos setting). Moreso meant for either running code in your own game, or letting your friends troll you, whatever else. You *can* allow strangers to run code but I don't advise it.
UserK 11 Nov, 2024 @ 5:28pm 
@anarcher that is acknowledge in the desc and its mentioned there are *some* safeguards, but even so, this is all within a safe mod. Which means the code is unable to do anything that an average workshop mod couldn't already do, so I'd argue probably safe
Probably.

responding to a nearly 2 year old comment is surely the greatest use of my time :clueless:
anarcher 22 Feb, 2023 @ 3:11am 
Ah yes, allowing strangers on the internet to run code on your system.
Hopefully you isolated it from anything important, because it will be infected eventually.