The State of LUA in DDA

Can I make PRs to extend lua bindings?
There is work branch to exntend lua bindings has proceeded by @BevapDin(GitHub). I’m afraid of affecting his work.

Sure, you can create PRs.

1 Like

Thx!:smile: I’m planning to expose classes and functions to lua.

Can I get a good example of how to view time durations on today’s experimental?

When I attempt to convert a time_duration via tostring, I get a result like "time_duration_metatable: 0x[pointer or reference address]. I can’t seem to view them, and I can’t seem to compare them with ints, I just get errors about comparing ints to time_duration_metatables, or more confusingly, time_duration_metatables to time_duration_metatables. Any help?

Use game.get_time_duration or wrapper functions from ./lua/autoexec.lua (TURNS, MINUTES, HOURS and DAYS) - see https://github.com/CleverRaven/Cataclysm-DDA/pull/24140.

I suppose there may be no LUA API such converting time_duration to integer. It is necessary that add function definition like
{ name = "to_turns", rval = "int", cpp_name = "to_turns<int>", args = { "time_duration" } },

Hmm… I’m trying to expose c++ classes and functions to LUA, and thinking about what functions to be exposed.

  1. Expose all functions as possible. (except less game rerated classes)
  2. Expose functions I’m planning to use only now.
  3. Discuss and decide what functions to be exposed.

1 requires very big changes. 3 may be waste of time. I suppose 2 is the better. What do you think?

There is no sense to expose anything you won’t use.

You must be married to an angry woman… wink :wink:

Seems jap mods use Lua more then others… reminds me of playing roblox and making my mini games… temted to relearn Lua and start making weird and crazy shit here in cata…

If life allows me to…

feel free to use Lua…