Unfortunately, this won't work well, because lua is called from the physw task, while the gui stuff expects to be run from spytask. Your drawing would be wiped out the next time the gui updated. You can see what it would be like by drawing directly to the bitmap buffers with poke (which does not require native calls).
In the long term, I'd definitely like to do something like this, but to do it well requires some work.
One way to do it would be to allow lua to add widgets that are drawn by the gui code every update until they are removed. This should be pretty straightforward.