Quote Originally Posted by ZorbaTHut View Post
Quote Originally Posted by Frostshizzle View Post
This seems to be a specificity to Lua that I will need to get accustomed to. I've made pauses in other languages before without issues. I don't mind it, I just need to find a way to deal with it, that's all.
There actually *are* ways to do this, but they take a little black magic. For example, maybe you want this code to do what it looks like it should do:
Code:
 local function Process()   for i = 1, 100 do     print(i)     Pause(1)   end end
Using the magic of coroutines, this is possible:
Code:
 local function Pause(seconds)   local start = Inspect.Time.Frame()   while start + seconds > Inspect.Time.Frame() do     coroutine.yield()   end end  local function Process()   for i = 1, 100 do     print(i)     Pause(1)   end end  local coro = coroutine.wrap(Process) table.insert(Event.System.Update.Begin, {coro, "TrionDevelopmentTools", "OnUpdate" })
It takes a little extra work, and I strongly recommend researching coroutines *heavily* before using them extensively, but it lets you write really deliciously clean code if you're willing to put the support structures around it and be extremely careful. (For example, this code starts erroring every frame once it's done with its count. You'll have to do better to make it work right.)
Jump to post...