I’m afraid that I’m not familiar with defining functions with colon, are you trying to attach this method to moveKeeper variable/object ?
Does this work:
local function myFunction() --blah blah end moveKeeper.myFunction = myFunction
Re your topic question, I’m calling functions normally while utilizing storyboard, they just need to be defined before where you call them, like normal Lua functions.
If these did not help, please post some more code, maybe I then be able to help.
This may be one of my main frustrations with Lua. There are too many ways to declare functions.
When you see:
someObject:someMethod()
you are adding a function someMethod to the object someObject. In Lua, objects are just overgrown tables. Therefore someObject has to exist prior to doing this:
local someObject = {} – make it an empty table for now, perhaps you spawned a table and returned it.
function someObject:someMethod()
– …
end
now works. Notice I did not make the function “local”. The object is local and I’m adding a member to it so you can’t use local.
Doing:
local someVarible = function()
is pretty much the same as:
local function someVariable()
with the most practical difference being that you can pre-declare the variable for forward referencing purposes:
local someFunction – just declaring the name here:
local function fred()
someFunction() – the compiler can code this since it knows the variable someFunction
I’m afraid that I’m not familiar with defining functions with colon, are you trying to attach this method to moveKeeper variable/object ?
Does this work:
local function myFunction() --blah blah end moveKeeper.myFunction = myFunction
Re your topic question, I’m calling functions normally while utilizing storyboard, they just need to be defined before where you call them, like normal Lua functions.
If these did not help, please post some more code, maybe I then be able to help.
This may be one of my main frustrations with Lua. There are too many ways to declare functions.
When you see:
someObject:someMethod()
you are adding a function someMethod to the object someObject. In Lua, objects are just overgrown tables. Therefore someObject has to exist prior to doing this:
local someObject = {} – make it an empty table for now, perhaps you spawned a table and returned it.
function someObject:someMethod()
– …
end
now works. Notice I did not make the function “local”. The object is local and I’m adding a member to it so you can’t use local.
Doing:
local someVarible = function()
is pretty much the same as:
local function someVariable()
with the most practical difference being that you can pre-declare the variable for forward referencing purposes:
local someFunction – just declaring the name here:
local function fred()
someFunction() – the compiler can code this since it knows the variable someFunction