Page 1 of 1

faulty arguments passed via remote.call(...)[0.12.29]

Posted: Mon Mar 28, 2016 5:24 pm
by Impatient
hi !

i encouinterd a problem with a remote interface call in version 0.12.29 . IMPORTANT'! the problem only occures when the interface is called from the same mod, that adds the interface. when called from another mod, this problem does not occure.

this is the interface:

Code: Select all

		remote.add_interface("DVM",
			{
				create_monitor = function (label)
					game.player.print(tostring(label))
                                        -- other code here
				end
			}
this is the call:

Code: Select all

		local monitor = remote.call("DVM","create_monitor","myLabel")
the remote function call itself works.

question: what should the variable "label" in the function "create_monitor" contain, when the function is called?
the string "myLabel"
, right?

but it doesn't. it holds a function reference.

the api doc says ( http://lua-api.factorio.com/0.12.29/LuaRemote.html#call ) all the values after the 2nd string in the function call are "Arguments to pass to the called function."

the code example in the api doc is

Code: Select all

remote.call("human interactor", "bye", "dear reader")
where "dear reader" would be the argument passed to the function.

is it a bug, or is it my faulty code?

thanks!

Re: faulty arguments passed via remote.call(...)[0.12.29]

Posted: Mon Mar 28, 2016 11:56 pm
by DaveMcW
why can't you use:

Code: Select all

local monitor = create_monitor("myLabel")

Re: faulty arguments passed via remote.call(...)[0.12.29]

Posted: Tue Mar 29, 2016 10:20 pm
by Impatient
DaveMcW wrote:why can't you use:

Code: Select all

local monitor = create_monitor("myLabel")
i can, but i was testing the remote interface. imo the interface should also work properly, when called by the mod, that registers it.

Re: faulty arguments passed via remote.call(...)[0.12.29]

Posted: Thu Mar 31, 2016 5:20 am
by Rseding91
Thanks for the report. This is now fixed for the next version.