Closed JekSun97 closed 10 months ago
The easiest way to do an update loop would probably be to have a function like your Update function, check if it exists and if it does call it each interval.
So,
extends Node
var lua = Lua.new()
func _ready() -> void:
lua.do_string("""
updates=0
function Update(delta)
updates = updates + 1
print("Update #"..updates)
print("Delta: "..delta)
end
""")
func _process(delta: float) -> void:
if lua.function_exists("Update"):
lua.call_function("Update", [delta])
I use library for godot 3.5+
I need to make the Update function in Lua, something like _process in a Godot, so that it is called all the time and at the same time the game itself does not freeze. What options can you offer? My code looks something like this:
LuaObject.do_string(" function Update()
update...
end ")