Defold 1.8.1 has been released

Whaaat? :cry: How can we then call any Teal code from script so that it’s type-checked? I did as it is written in the teal extensions readme. No posibility? What’s the advantage then?

Yes, type checking happening only in tl files. But you can avoid using Lua using this trick:

  1. Create my.*_script
  2. Create my.lua (it works with Teal as well)
  3. in lua file:
local function init(self)
end

local function on_message(self, message_id, message, sender)

end

local function on_input(self, action_id, action)
   
end

local function update(self, dt)
   
end

return function()
    _G.init = init
    _G.on_message = on_message
    _G.on_input = on_input
    _G.update = update
-- ...etc
end
  1. in script file: require(“my”)()

  2. Keep script file a one-liner + maybe some go.properties()

2 Likes

Thank you!

What is this annotation? (In this project there is no Teal-extension, but there is Lua Language Server) It’s in Lua module:

image

Beside I can simply in this case initialize it with string.find() result, so in only one line, but sometimes I want the value to be set by default at first and the change it (here also I can change it to default after operations fail to initialize it in some cases).

I’m just curious how it is treated in dynamically typed Lua.