SCRIPT-A:
Code: Select all
remoteScript = findEntity("SCRIPT-B")
remoteScript:myRoutine(2)
Code: Select all
function myRoutine(n)
print(n)
end
Thank you! -Lark
Code: Select all
remoteScript = findEntity("SCRIPT-B")
remoteScript:myRoutine(2)
Code: Select all
function myRoutine(n)
print(n)
end
Rescued again! Thank you Lmaoboat! I've been stuck on this for hours and finally gave up and asked for help. Now I can finish my next big script and post it soon. I've already thought of a better way to rewrite it, but heck, I need to finish this version first. More soon!Lmaoboat wrote:I think all you have to do is SCRIPT-B.myRoutine(2)
Fantastic! This makes perfect sense now, thank you. The table passed is the object invoking the function, so you could have three buttons, for example, invoke the same function in a script and the script could determine which of the three was pressed by looking at table.id. As it turns out, I need this. I've been disappointed that connections can't pass arguments to functions, but now there's no need - the arguments would be static anyway and just identifying the button (or other object) is good enough!BeNNyBiLL wrote:This is why you were getting a table with your result, as instead of getting a compilation error, lua just drops the last parameter as the function doesn't support more than 2 parameters. Deeper explanation found here http://www.lua.org/pil/16.html
Code: Select all
function printThisOut(sender, pMessage1, pMessage2, pMessage3, pMessage4)
print(pMessage1, pMessage2, pMessage3, pMessage4)
end
Code: Select all
demo:printThisOut("One", "Two", "Three", "Four")