lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello, I'm new to this list.  My background in nodeJS and I'm learning Lua for fun.  So far it seems very interesting.

I'm trying to use luajit's built-in ffi module to make OpenGL ES 2.0 calls using the GLESv2/gl2.h header.  I have the header properly parsed and everything is working fine, but I can't seem to figure out how to pass in strings to functions that accept char*

I'm using <http://luajit.org/ext_ffi_tutorial.html> as my source of documentation and for the most part, it's very useful.

In particular, I'm trying:

    local string = ffi.new("GLchar*[1]")
    string[0] = str
    GLESv2.glShaderSource(shader, 1, string, #str)

And I get the error: cannot convert 'string' to 'char *'

Surely this is supported.  I've searched on the googles, but can't seem to find anything.

Could Mike Pall or someone else who knows how to do this help me out?  Thanks.

-Tim Caswell