LDCall Extension - Printable Version +- Small Basic Forum (https://litdev.uk/mybb) +-- Forum: Small Basic (https://litdev.uk/mybb/forumdisplay.php?fid=1) +--- Forum: Extensions (https://litdev.uk/mybb/forumdisplay.php?fid=3) +--- Thread: LDCall Extension (/showthread.php?tid=56) Pages:
1
2
|
LDCall Extension - z-s - 04-29-2024 How Can We Get The Errors in SB Code When Using LDCall.Compile ?? RE: LDCall Extension - litdev - 04-29-2024 All this does is call the Small Basic compiler, there are no errors using this. Check your sb file compiles first before using this method. RE: LDCall Extension - z-s - 04-30-2024 I Mean If There Is An Error In SB File How Will We Get It Through The Method. RE: LDCall Extension - litdev - 04-30-2024 ZS, Sorry, you cannot get details of compilation errors from these methods. RE: LDCall Extension - AbsoluteBeginner - 05-19-2024 Please tell me if I can read somewhere about how to use the "LDCall.CallInclude()" method correctly? How to create an include file correctly? And how to correctly use the variables in these two files? Does the include file see the variables that are in the program that calls it? And does the calling program see the variables created in the include file? Thank you. RE: LDCall Extension - litdev - 05-19-2024 Hi, There is no additional documentation, see the intellisense documentaion for LDCall.Include and LDCall.CallInclude. To be totally honest I can't remember exactly and would have to do some tests to be sure. First have a go, and a few tests should answer the questions. If you have questions after your tests then I'm happy to help with these and show the actual logic used, which is also available by looking at LitDev.dll using dotPeek for example. This kind of detective work is a big part of working out how stuff works - it's unusual to find an exact answer to every specific question. RE: LDCall Extension - AbsoluteBeginner - 05-19-2024 (05-19-2024, 05:07 PM)litdev Wrote: ... I completely agree with you. But, my parents and my life taught me to ask people first. If I hadn’t asked, I would have given rise to jokes at my expense: “You’re an eccentric. What, you couldn’t ask, or what?” Thanks a lot. All the best to you. RE: LDCall Extension - litdev - 05-20-2024 It's a bit trick to work out the logic, so here it is: There are probably a limited number of situations where CallInclude makes more sense than just copying the subroutine into your code. When the include subroutine is called it knows nothing about the rest of the include program code, as if we just copied the subroutine into the main program. First create and compile the include program with a subroutine we want to use. There is a 3 step process when CallInclude is run, assuming all files exist compiled etc. 1] All calling program variable values (that have the same name in both programs) are copied to the include program. 2] The include subroutine is called. 3] All include variables (some may now be modified by the subroutine) are copied back to the main program. Consider include program (Include.sb): Code: x = 1 And calling program: Code: x = 2 Step 1] In included code : x set to 2, z set to 2, y is unset (default 0) - remember the CallInclude only looks at the subroutine MySub, it knows nothing about previous code that sets y = 1 for example. Step 2] MySub sets z = 2+2+0 = 4 Step 3] In main program : x set to 2, z set to 4 Resulting output: Include1 SUCCESS x=2 z=4 Press any key to continue... RE: LDCall Extension - AbsoluteBeginner - 05-20-2024 Oho!.. It looks like I didn't "ask first" for nothing. I was aware of the variable visibility issue. But, I wouldn't have guessed about "passing values" of variables that have the same names. Thanks a lot. I wanted to use an include file so as not to clutter the Server code with Snake AI code. Well, in general, it’s useful and interesting to learn something new. Thank you. RE: LDCall Extension - z-s - 05-21-2024 You could see examples of ldcall in litdev samples |