Skip to content

v0.32: Program libraries and Rust improvements

Compare
Choose a tag to compare
@github-actions github-actions released this 05 Dec 20:33
· 58 commits to main since this release
2cc72a5

It's now possible to download pre-made programs using Sandbox.download_program("name"):

if !FileAccess.file_exists("res://luajit.elf"):
	var buffer = Sandbox.download_program("luajit")
	var fa = FileAccess.open("res://luajit.elf", FileAccess.WRITE)
	fa.store_buffer(buffer)
	fa.close()

var luajit = Node.new()
luajit.set_script(load("res://luajit.elf"))
luajit.execution_timeout = 0
luajit.add_function("test", func(name): return "Test " + str(name) + " called!")
luajit.add_function("add", func(a, b): return a + b)
luajit.run("""
print(test(1))
print(add(333, 666))
function fib(n, acc, prev)
	if (n < 1) then
		return acc
	else
		return fib(n - 1, prev + acc, acc)
	end
end
print("The 500th fibonacci number is " .. fib(500, 0, 1))
""")

Read more about this feature here.

Rust has gained a new GodotString and access to the public API:

extern "C"
fn test(a: i32, b: i32, c: GodotString) -> Variant {
	let sum = a + b + c.to_string().parse::<i32>().unwrap();
	Variant::new_integer(sum.into())
}

pub fn main() {
	register_public_api_func3("test", test, "int", "int a, int b, String c");
}

Also:

  • Fixed a rare bug with shared execute segments in libriscv
  • Removed old Public API method as it didn't work with all languages, nor with stripped binaries
  • Added new Public API method that is accessible during int main() (startup).
  • Implement Public API support for sandboxes loaded from byte arrays
  • Fixed empty Public API argument list appearing as Object
  • Add support for Zig cc/c++ RISC-V builds using riscv64-linux-musl
  • Fix multiple build issues when LLVM's libc++ is the standard library
  • Add alternative API paths for when std::string is not 32-byte with 16b SSO
  • Fixed compiler flags for C sources when using the CMake API

What's Changed

  • Allow creating public API at init through system call by @fwsGonzo in #230
  • Add function to download a known program from programs repo by @fwsGonzo in #231

Full Changelog: v0.31...v0.32