LuaControl Teleport() errors when same surface provided for entities
Posted: Sat Dec 22, 2018 10:30 pm
When using the LuaControl.Teleport() function on an entity (ie: car) and the current surface is provided it returns a custom Factorio error message:
Also the error message itself doesn't match up with working usage and what the API documentation says.
API function link:
https://lua-api.factorio.com/latest/Lua ... l.teleport
Sample erroring code:
Sample working code (same intended result):
However, if no surface is specified there is no error and the command runs correctly. The surface argument is optional in the documentation.Also the error message itself doesn't match up with working usage and what the API documentation says.
API function link:
https://lua-api.factorio.com/latest/Lua ... l.teleport
Sample erroring code:
Code: Select all
/c
local surface = game.player.surface
local startPos = {x = 1, y = 1}
local treeEntity = surface.create_entity{name="car", position = startPos}
local newPos = {x = 2, y = 2}
treeEntity.teleport(newPos, surface)
Code: Select all
/c
local surface = game.player.surface
local startPos = {x = 1, y = 1}
local treeEntity = surface.create_entity{name="car", position = startPos}
local newPos = {x = 2, y = 2}
treeEntity.teleport(newPos)