Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lua #2043

Draft
wants to merge 111 commits into
base: master
Choose a base branch
from
Draft

Lua #2043

wants to merge 111 commits into from

Conversation

PieterVdc
Copy link
Member

@PieterVdc PieterVdc commented Dec 12, 2022

not final yet, but works, will probably use code as a dependency instead, but for now it uses a precompiled dll

@AleWin32
Copy link
Contributor

Hello @PieterVdc, what is this PR? It adds Lua scripting to KeeperFX instead of its own scripting language?

@PieterVdc
Copy link
Member Author

not as a replacement, but yeah as a second level script, still in early stage, but on the discord I uploaded a sample map that uses it
https://discord.com/channels/480505152806191114/1051878771692675082

@SimLV
Copy link
Contributor

SimLV commented Dec 28, 2022

Why you have to bring lua.h and others? I assume only luaconf.h is necessary and other files should be attached using git submodule or something like that.
Also API should be invented first. Raw ThingId is not userfriendly. Some userdata (not lightuserdata!) with list of thing-ids would be much better.

@PieterVdc
Copy link
Member Author

PieterVdc commented Dec 28, 2022

indeed, but I started with just a quick draft test to get a quick idea of what would be needed, before doing it proper
and yeah started with the dll, but was going to replace it with luau, as a submodule, so will delete the stuff in lib after I switched

@@ -112,8 +114,6 @@ function TriggerRegisterThingEvent(trigger, thing, thingEvent)
return event
end

-- Trigger variables

--- Gets the unit associated with the current triggering event
--- @return Thing|nil
function GetTriggeringThing()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is bad as a concept.
Just pass things from On...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's based on the wc3 script, this way allows multiple events to trigger the same action, so can't know the exact params without having a fixed action that triggers it

Game.triggers = {}
end
local trigger = { events = {} }
function CreateTrigger(name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not
CreateTrigger(name, conditions, actions)
with or {} for optionals

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants