Writing modules in Rust?

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

Writing modules in Rust?

by burli » Mon Jan 02, 2017 10:00

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

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: Writing modules in Rust?

by rubenwardy » Mon Jan 02, 2017 12:48

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
 

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

Re: Writing modules in Rust?

by burli » Mon Jan 02, 2017 13:22

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
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: Writing modules in Rust?

by rubenwardy » Mon Jan 02, 2017 13:26

 

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

Re: Writing modules in Rust?

by burli » Mon Jan 02, 2017 15:29

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

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

Re: Writing modules in Rust?

by kaadmy » Sun Jan 08, 2017 20:42

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.
 

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

Re: Writing modules in Rust?

by trev » Sat Jan 14, 2017 16:00

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: 627
Joined: Thu Aug 27, 2015 23:07
GitHub: kaadmy
IRC: KaadmY
In-game: KaadmY kaadmy NeD

Re: Writing modules in Rust?

by kaadmy » Sun Jan 15, 2017 01:16

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.
 

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

Re: Writing modules in Rust?

by trev » Sun Jan 15, 2017 15:50

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


Return to Minetest Engine

Who is online

Users browsing this forum: No registered users and 1 guest

cron