31 posts
Location
Brazil
Posted 18 May 2014 - 09:04 PM
Is it possible to stabilish "global" functions that I can call in in any program?
like
function rednetSend(msg)
msg = tostring(msg)
redenet.broadcast(msg)
end
So i can call it in any program i have.
1281 posts
Posted 18 May 2014 - 09:06 PM
You just did, any non local variable is acessible from all programs after it has been defined until the computer reboots.
570 posts
Posted 18 May 2014 - 09:07 PM
No, not really. But you can make an API.EDIT: Never mind, just tried it, CometWolf is right. Lua never ceases to amaze me with its magic.
Edited on 18 May 2014 - 07:08 PM
31 posts
Location
Brazil
Posted 18 May 2014 - 09:07 PM
So if I run a program called "function" then terminate it an imediatly after i execute rednetSend("Hello") the message will be sent?
570 posts
Posted 18 May 2014 - 09:09 PM
So if I run a program called "function" then terminate it an imediatly after i execute rednetSend("Hello") the message will be sent?
Yes.
31 posts
Location
Brazil
Posted 18 May 2014 - 09:14 PM
Well, thank you so! :D/>