Embedded programming language for Zig
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

It would've made sense to add a `throw` function along with `setexcept` :)

IamPyu c15d85b4 ca81baa5

+7
+7
src/corelib.zig
··· 36 36 .{ "map", try Value.initNativeFunc(scope, map) }, 37 37 .{ "loadlib", try Value.initNativeFunc(scope, loadlib) }, 38 38 .{ "setexcept", try Value.initNativeFunc(scope, setexcept) }, 39 + .{ "throw", try Value.initNativeFunc(scope, throw) }, 39 40 40 41 .{ "add", try Value.initNativeFunc(scope, add) }, 41 42 .{ "sub", try Value.initNativeFunc(scope, sub) }, ··· 484 485 485 486 try scope.setException(msg); 486 487 return Value.initNil(scope); 488 + } 489 + 490 + pub fn throw(scope: *Scope, args: []*const Value) RuntimeError!*Value { 491 + _ = scope; 492 + _ = args; 493 + return RuntimeError.Exception; 487 494 } 488 495 489 496 // -- OPERATORS --