lua as dll

Things that we aren't going to implement
Post Reply
Asynchron
Burner Inserter
Burner Inserter
Posts: 18
Joined: Fri Dec 02, 2022 9:10 pm
Contact:

lua as dll

Post by Asynchron »

Hi,

So I've been looking over bin folder of Factorio, and noticed that there isn't any lua dll present there, meaning that most probably it was statically linked into executable.
I'm just wondering, would it be possible to have a Factorio version that uses lua as a dll, or is there one already? (I'm a steam user)

This would allow wrapping of said dll into another one, that possibly could extend the scripting capabilities (luajit perhapsss), or such as employing a completely different language, be it scripted or compiled. Obviously such modifications and mods employing them shouldn't be allowed on official portal due to security considerations of the player (viruses, worms, etc.) (orr, perhaps with a reaally good warning), but for personal mods this would quite improve the experience of mods with heavyweight logic. Custom ai, pathfinding, automatic factory building, or any heavyweight logic that might improve factorio experience, or expand it.

For my personal mods (and personal use mostly), I was wondering if I could for example employ D language to build mods that require quite a lot of computation.

Best regards,
Asynchron

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 2318
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: lua as dll

Post by boskid »

No.

There is quite tight integration between Lua and rest of game code and we are not interested in huge performance loss due to all lua function calls going to a dll (which is windows specific solution) or more complex code because of not being able to investigate state of lua objects directly when performance is critical (iterating various tables when passing data between mods due to remote interface, or data saving).

Asynchron
Burner Inserter
Burner Inserter
Posts: 18
Joined: Fri Dec 02, 2022 9:10 pm
Contact:

Re: lua as dll

Post by Asynchron »

So basically you're saying that most of lua functions (C functions from lua lib) are inlined to avoid function call right?

Btw, I obviously meant shared library, which dll is in windows.

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 2318
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: lua as dll

Post by boskid »

I am not saying they are inlined but they may be based on compiler discretion given the amount of optimization switches we have turned on.

We treat lua as a library but because we are directly using some of the structures defined inside of lua header files, if a memory layout of some objects would change it would start crashing so there is no point in having lua be a separate shared library.

Post Reply

Return to “Won't implement”