Initial flame_lua_runtime package

This commit is contained in:
gem
2026-06-07 22:53:58 +08:00
commit 733b2fb798
262 changed files with 28439 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
local state = runtime.import("state")
local ui = runtime.import("ui")
---@type RuntimeCommands
local commands = runtime.import("runtime_commands")
function smoke_test(ctx)
return ctx ~= nil
and ctx.runtimeApiVersion ~= nil
and ui.create_nodes ~= nil
and commands.toast ~= nil
end
function init(ctx)
state.status = "Template ready: " .. tostring(ctx.gameId or "template")
return {
render = { creates = ui.create_nodes() },
ui = {},
commands = {}
}
end
function on_event(event)
if event.handler == "template_start" then
state.started = true
state.clicks = state.clicks + 1
state.status = "收到 tap 事件Lua 已返回 Diff 和 toast command。"
return {
ui = { updates = ui.state_updates() },
commands = {
commands.toast("Template event handled in Lua", { duration = 1.2 })
}
}
end
return {}
end