How can I use C++ code in Lua?

Place to get help with not working mods / modding interface.
jime
Manual Inserter
Manual Inserter
Posts: 1
Joined: Fri Dec 23, 2022 3:44 pm
Contact:

How can I use C++ code in Lua?

Post by jime »

Im tring to make a mod and I hope I can use my previous code.
Rseding91
Factorio Staff
Factorio Staff
Posts: 15903
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: How can I use C++ code in Lua?

Post by Rseding91 »

Factorio mods only support writing them in Lua. So the answer is: you can't.
If you want to get ahold of me I'm almost always on Discord.
DarkShadow44
Filter Inserter
Filter Inserter
Posts: 360
Joined: Thu Jun 01, 2017 12:05 pm
Contact:

Re: How can I use C++ code in Lua?

Post by DarkShadow44 »

Even if you could, I don't see how it would be useful to recycle old code. You need to use a lot of factorio specific features. What exactly are you trying to do/reuse?
robot256
Smart Inserter
Smart Inserter
Posts: 1248
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Re: How can I use C++ code in Lua?

Post by robot256 »

If you don't want to reinvent the wheel, take a look at some of the existing mod libraries, like Factorio Library . You can use any of them as a dependency for your mod, and use the functions they maintain.
My mods: Multiple Unit Train Control, RGB Pipes, Shipping Containers, Rocket Log, Smart Artillery Wagons.
Maintainer of Auto Deconstruct, Cargo Ships, Vehicle Wagon, Honk, Shortwave.
Post Reply

Return to “Modding help”