CC: Tweaked

CC: Tweaked

42M Downloads

Inconsistent error message with getfenv()

Kan18 opened this issue ยท 2 comments

commented

Useful information to include:

  • Minecraft 1.12.2
  • CC: Tweaked 1.84.0
  • using CodersNet modpack
  • Detailed reproduction steps:
    Open a new computer and open /rom/programs/lua. Doing getfenv(false) or getfenv(true) (or with a table) will show the error message of: 'bad argument: integer expected, got (type)'. getfenv("test") (or any other string) will show the error message of: bad argument: number expected, got string.
    image Normal behavior of Lua looks like this:
    image
commented

While this is a CC:T/Cobalt bug, please stop using getfenv. If we ever move to Lua 5.2+, it's going to break.

commented

I wasn't depending on getfenv but for my sandboxing system I was sandboxing getfenv and setfenv so that malicious programs couldn't escape the sandbox, and I noticed this while looking at error messages.