Skip to content
/SLASHPLAY

How to run Lua commands on a Factorio server

Type /c <lua> in the Console tab of your SLASHPLAY server or in game chat as an admin, for example /c game.print("hello"). The first time, send it twice: it disables achievements.

c

Runs a line of Lua on the server, for anything the other commands can't do. The first use disables achievements on the map.

/c <lua>

Examples

/c game.print("Server restart in 5 minutes")

Prints a message to everyone.

/c rcon.print(game.tick)

From the Console tab: prints the current tick.

/c game.player.force.research_all_technologies()

In game: researches everything for your force.

Arguments

luaRequired
One line of Lua. In game, game.player is you; from the Console tab, rcon.print() sends output back.

What it does

/c, short for /command, runs Lua against the game's API: print a value, change a force, fix a stuck entity. Every player sees the line you ran; use /silent-command to hide it.

Good to know

  • The first Lua command on a map only prints a warning that it disables achievements. Send it again to run it; achievements stay off for that save.
  • Who may use it in game is set by allow_commands (admins only by default). The Console tab always can.
  • On SLASHPLAY, type it in the Console tab of the server page, with the leading slash. The Console runs it as the server, so it needs no admin rights.

Run it on your server

Type commands with the leading slash in the Console tab, which runs them as the server; in game, admins type them in chat. Settings go in config/server-settings.json in the Files tab and apply at the next restart. New to this? Start a Factorio server first.

Your own
Factorio server.

From $0.03 an hour, only while it runs. New accounts get 6 free tokens.