Writing modules in Rust?

For people working on the C++ code.
Post Reply
User avatar
burli
Member
Posts: 1643
Joined: Fri Apr 10, 2015 13:18

Writing modules in Rust?

by burli » Post

Is it possible to write modules like a mapgen or other Mods in Rust? What are the requirements?

User avatar
rubenwardy
Moderator
Posts: 6972
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: Writing modules in Rust?

by rubenwardy » Post

You either need to:

Rewrite the lua api cpp code in src/scripting/ to support multiple languages including Rust

or

Run Rust binaries from Lua: https://github.com/tomaka/hlua#creating-a-lua-module
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
burli
Member
Posts: 1643
Joined: Fri Apr 10, 2015 13:18

Re: Writing modules in Rust?

by burli » Post

rubenwardy wrote:You either need to:

Rewrite the lua api cpp code in src/scripting/ to support multiple languages including Rust

or

Run Rust binaries from Lua: https://github.com/tomaka/hlua#creating-a-lua-module
That's if I want to write a mod. And I'm not sure if this works because it is for Lua 5.2. Nothing about luajit so far


But what if I want to write a native mapgen, e.g. by replacing the Boilerplate Code with Rust?

User avatar
rubenwardy
Moderator
Posts: 6972
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: Writing modules in Rust?

by rubenwardy » Post

Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
burli
Member
Posts: 1643
Joined: Fri Apr 10, 2015 13:18

Re: Writing modules in Rust?

by burli » Post

Is the Boilerplate still valid code? Can't find any registerMapgen Function in the current dev

User avatar
kaadmy
Member
Posts: 706
Joined: Thu Aug 27, 2015 23:07
GitHub: kaadmy
IRC: KaadmY
In-game: KaadmY kaadmy NeD

Re: Writing modules in Rust?

by kaadmy » Post

Another language I've found recently is Wren (http://wren.io/). It's not as fast as Lua (without JIT), but it's simpler to use and has more refined syntax and layout that Lua/Rust IMO.
Never paint white stripes on roads near Zebra crossings.

Pixture

User avatar
trev
Member
Posts: 45
Joined: Fri Sep 26, 2014 16:49
In-game: trev

Re: Writing modules in Rust?

by trev » Post

Wow. Wren looks like a cool language. The documentation doesn't seem finished, though. The section on the C API says "TODO", so I guess we're on our own there.
Do what you love, and you will love what you do! :)

User avatar
kaadmy
Member
Posts: 706
Joined: Thu Aug 27, 2015 23:07
GitHub: kaadmy
IRC: KaadmY
In-game: KaadmY kaadmy NeD

Re: Writing modules in Rust?

by kaadmy » Post

The header file for the C-side API is commented nicely, it includes enough information to use it.
Never paint white stripes on roads near Zebra crossings.

Pixture

User avatar
trev
Member
Posts: 45
Joined: Fri Sep 26, 2014 16:49
In-game: trev

Re: Writing modules in Rust?

by trev » Post

Oh, nice!
Do what you love, and you will love what you do! :)

User avatar
numzero
New member
Posts: 8
Joined: Tue Apr 21, 2015 18:51
GitHub: numberZero
IRC: numzero

Re: Writing modules in Rust?

by numzero » Post


Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests