lua-users home
lua-l archive

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


>I was wondering wether it's possible to do any of this in Lua:
>1)'export' a C variable meaning that you create a lua var which is 'in
>sync' with a C var.And what's more important...

Yes. Use userdata containing the address of the C variable and add metamethods
to handle reading and writing to it.

>2)I was hoping that there would be some way to get rid of the wrappers
>for ech C function you wan't to call from lua code.Would it be
>possible to write a universal wrapper that get's called in every
>function call,then gets the function address and args (somehow... like
>from the stack) and calls the C function(via inline assembly).

Not portably, but yes. I think libffi (I forget the name) does this.
--lhf