foxygit / fake-08-xbox360 Log in
commit f1290fe6316d3701ff09098d40e9685622cadd5a
Author:     Jon Bell <j.to.the.bell@gmail.com>
AuthorDate: Sat Apr 16 08:14:55 2022 -0600
Commit:     Jon Bell <j.to.the.bell@gmail.com>
CommitDate: Mon Jun 27 18:56:16 2022 -0600

    use other update function if user changed fps
---
 source/vm.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/source/vm.cpp b/source/vm.cpp
index e4453fa..8a6c159 100644
--- a/source/vm.cpp
+++ b/source/vm.cpp
@@ -535,8 +535,14 @@ void Vm::UpdateAndDraw() {
         // Push the _update function on the top of the lua stack
         if (_targetFps == 60) {
             lua_getglobal(_luaState, "_update60");
+            if (!lua_isfunction(_luaState, -1)) {
+                lua_getglobal(_luaState, "_update");
+            }
         } else {
             lua_getglobal(_luaState, "_update");
+            if (!lua_isfunction(_luaState, -1)) {
+                lua_getglobal(_luaState, "_update60");
+            }
         }

         if (lua_isfunction(_luaState, -1)) {