Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mr_call(L) = R :-
- [E, _] = solutions(try(mr_call(L))),
- require_complete_switch [E]
- ( E = succeeded(R)
- ; E = failed,
- impure lua_pushboolean(L, no),
- R = 1
- ; E = exception(U),
- impure lua_pushnil(L),
- impure lua_pushuniv(L, U),
- R = 2
- ).
- :- pred mr_call(lua::in, int::out) is cc_multi.
- mr_call(L, R) :-
- semipure lua_getupvalue(L, 1),
- semipure univ(F) = lua_touserdata(L, -1) ->
- R = F(L)
- ;
- impure lua_error(L,
- "Called Mercury function without valid func upvalue.").
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement