Posted 21 September 2016 - 01:32 AM
Hi :D/>
Okay, recently I am coding an API (Advanced Math API) and the problem I've ran into is the following:
I have a function -for the sake of simplicity let's just call it "func_1"- and another local function -naming it "func_2" and both are situated in
the "root" layer of that program (e.g. are not in another function, but can be called with MyAPI.func_1, func_2 is local), so the program
looks -more or less- like this:
Then we have another program, loading the API and running it's func_1 function:
What I would expect the program to output is this:
But instead I get an error at
I have no Idea what causes this at what fixes it, I tried making the function a global.. nothing worked, and I dont want the function func_1 saying something like
Any help?
Thanks in advance, Alex
Okay, recently I am coding an API (Advanced Math API) and the problem I've ran into is the following:
I have a function -for the sake of simplicity let's just call it "func_1"- and another local function -naming it "func_2" and both are situated in
the "root" layer of that program (e.g. are not in another function, but can be called with MyAPI.func_1, func_2 is local), so the program
looks -more or less- like this:
Spoiler
--Test Program!--
function func_1(text1, text2)
print(text1)
func_2(text2)
end
function func_2(text_to_print)
print(text_to_print)
end
Then we have another program, loading the API and running it's func_1 function:
Spoiler
--API Loader--
os.loadAPI("Path/to/api")
api.func_1("Hello", "World")
What I would expect the program to output is this:
Spoiler
Hello
World
But instead I get an error at
Test Program: 5: Attempt to call nil
I have no Idea what causes this at what fixes it, I tried making the function a global.. nothing worked, and I dont want the function func_1 saying something like
function func_1(text1, text2)
print(text1)
api.func_2(text2)
end
because that is slowing down the program and also making it able to call random "internal use only" functions in the program.Any help?
Thanks in advance, Alex
Edited on 20 September 2016 - 11:34 PM