LUA C# variables
Hello!
i've been using LUA in my C#-project to use simple commands like LoadMap() and LoadState() and up until now i've only modified variables througth functions.
the problem is that i want to be able to jump out of a script for a while and into the render-loop, then jump right back into the script where i was.
script example:
LockEverything();
FadeOut(); //Fading out the screen in like 3 sec
LoadMap();
FadeIn();
FadeOut() sets a variable that indicates it's time to draw the fade-effect but to do this i have to (offcourse) run the render-loop for a while.
So, what i want to do is to wait for the FadeOut() to finish before I call LoadMap.
Which would be the best way to solve this?
When Lua calls a function, it waits for the function's return value. Taking that into consideration, you can have the FadeOut function fade the screen within itself and Lua will just wait for it to complete and return a value. If you just put the fading code within a for loop with some System.Threading.Thread.Sleep() calls, you'll beable to get the desired effect you're looking for.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement