Foldit Wiki
Advertisement

Lua comes with some standard libraries that can be included in the distribution. Currently foldit has no support for these standard libraries. The following functions should be added to the foldit distribution:

Standard Functions

The following standard functions should be included or excluded as shown:

  • G: ?
  • _VERSION: ?
  • assert: include
  • collectgarbage: ?
  • dofile: ?
  • error: ?
  • getfenv: ?
  • getmetatable: ?
  • ipairs: ?
  • load: ?
  • loadfile: ?
  • loadstring: ?
  • module: ?
  • next: ?
  • pairs: ?
  • pcall: ?
  • print: already implemented
  • rawequal: ?
  • rawget: ?
  • rawset: ?
  • require: ?
  • select: ?
  • setfenv: ?
  • setmetatable: ?
  • tonumber: ?
  • tostring: ?
  • type: ?
  • unpack: ?
  • xpcall: ?

Coroutine Functions

The coroutine functions can be excluded from the distribution. There are only limited places where these would be useful since most of the scripts interact with the UI, and only one UI operation can be in effect at any one time.

Debug Functions

These debug functions can be excluded from being able to be called by scripts. However, they might be used by the foldit user interface. Having a scripting debugger would be a useful addition, allowing stepping through the code a line at a time. This is, however, a lower priority than many other things.

File and IO Functions

These functions, while useful, make foldit a potential vector for numerous security problems. The only way they should be added to the game is if they are limited to a reading files from particular directory on the disk. Any function that is able to write to the disk is excluded. Probably better to just exclude them altogether. Some foldit functions might allow a very limited set of file operations to one directory on the disk.

Math Functions

We need the entire Lua standard math library to be added to the distribution. This should be entirely safe.

OS Functions

Some of these are very dangerous, but others are completely harmless and useful. The following functions are safe and should be implemented:

os.clock os.date os.difftime os.time

Package Functions

The package functions should be excluded for security reasons.

String Functions

We need the entire Lua standard string library to be added to the distribution. This should be entirely safe.

Table Functions

We need the Lua standard table library to be added to the distribution. This is no more dangerous than other parts of Lua, where a runaway or malicious script can eat all available memory.

Lua and LuaL Functions

The Lua and LuaL functions should be excluded.

Advertisement