Page 1 of 1

Writing modules in Rust?

PostPosted: Mon Jan 02, 2017 10:00
by burli
Is it possible to write modules like a mapgen or other Mods in Rust? What are the requirements?

Re: Writing modules in Rust?

PostPosted: Mon Jan 02, 2017 12:48
by rubenwardy
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

Re: Writing modules in Rust?

PostPosted: Mon Jan 02, 2017 13:22
by burli
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?

Re: Writing modules in Rust?

PostPosted: Mon Jan 02, 2017 13:26
by rubenwardy

Re: Writing modules in Rust?

PostPosted: Mon Jan 02, 2017 15:29
by burli
Is the Boilerplate still valid code? Can't find any registerMapgen Function in the current dev

Re: Writing modules in Rust?

PostPosted: Sun Jan 08, 2017 20:42
by kaadmy
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.

Re: Writing modules in Rust?

PostPosted: Sat Jan 14, 2017 16:00
by trev
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.

Re: Writing modules in Rust?

PostPosted: Sun Jan 15, 2017 01:16
by kaadmy
The header file for the C-side API is commented nicely, it includes enough information to use it.

Re: Writing modules in Rust?

PostPosted: Sun Jan 15, 2017 15:50
by trev
Oh, nice!