Jump to content




help please (functions and stuff)

computer lua help computer lua help

2 replies to this topic

#1 joshgreat

  • Members
  • 33 posts

Posted 19 October 2016 - 05:28 PM

hi guys
yep im back for help
for WOS 2.0 i need functions but cant figure out how to use them
the link for this is http://pastebin.com/7ZDgrfvy
thanks
-JoshGreatUK

#2 Lupus590

  • Members
  • 2,029 posts
  • LocationUK

Posted 19 October 2016 - 06:03 PM

you need to define functions before you use them:

local function foo() --# define the function
  --# code here will execute when function is called
  --# multiple lines are accepted
end

local bar = function() --# alternative way of defining functions
  --# content as above
end

foo() --# call the function
bar() --# calling is the same nomater how it was defined

Edited by Lupus590, 19 October 2016 - 06:05 PM.


#3 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 19 October 2016 - 06:39 PM

It looks like you have function calls to non-existent functions. Define those functions at the top of your script.

Ex:
local function helloWorld()
  print( "Hello, World!" )
end
--#later on in the program, calling it
helloWorld()






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users