Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(1 edit)

Please, I need some help with this,  to get a better guile hoot understanding.  

I'm trying to create a toggle full-screen  command.

(define-foreign full-screen-element
  "document" "fullscreenElement"
  (ref extern) ->   (ref null extern) )

I already have the full-screen and exit full-screen commands. But the command required for testing is giving me some trouble.

The function returns either null or the element, I expected that the null value would be considered as false in scheme but it is not the case.  I'm supposed to cast these values ? test for the string "null" ? or is my usage of define-foreign wrong?

Edited: I found out about the external-null?  and external-non-null? this work for the mentioned example but I'm still confused about the general approach for define-foreign.  Extra care is needed for those functions in scheme code?

Yeah, extra care is needed. A null extern ref is like a null pointer in Guile's C FFI, basically.