Jump to content




Question about some lines of code


  • You cannot reply to this topic
2 replies to this topic

#1 The Penguin21

  • Members
  • 19 posts
  • LocationC:\Windows\System32\

Posted 05 October 2015 - 12:36 PM

Thanks :D the program is awesome!


Im new to computercraft and i would like if someone tells me what is the:
function RCmaster()
and
RCmaster()
(at end) for, also about:
local sEvent, param = os.pullEvent("key")
.



Thanks! :)

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 05 October 2015 - 02:33 PM

I've split this from here, to prevent unnecessary necromancy.

#3 TheOddByte

    Lazy Coder

  • Members
  • 1,607 posts
  • LocationSweden

Posted 05 October 2015 - 02:56 PM

This line of code declares a new function called "RCMaster"
function RCMaster()

And this one calls the function "RCMaster"
RCMaster()

An example
--# Here we declare the function foo
--# when the function is called it will
--# run all the code the function contains
local function foo()
    print( "bar" )
end

foo() --# Call the function "foo", it should output "bar"( without the quotes ofcourse )


And the final line
local sEvent, param = os.pullEvent( "key" )
This line calls the function os.pullEvent, with the parameter "key", which will make it only listen for key events.
When a key event has been pulled it returns the following variables: event, key.
I'd recommend you check out the wiki about os.pullEvent here





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users