lua-users home
lua-l archive

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


On Friday 25, CrazyButcher wrote:
> very cool thanks!
> 
> One little syntactic sugar would have been to allow argument
> definitions passed as single string
> "int" "x" seems a bit tedious (of course one can write a function to
> return the table you set up there, but why not make that the default?)
> Why did you avoid a default string-splitting?

I hadn't thought about doing that.  But there might be some cases where the 
variable markings clash with pointer types (i.e. to mark a pointer parameter 
as pass by-value you add * to the start of the name).  See the last section in 
the README.md [1] file for more info about marking variables.

It might be possible to do something like:
  c_call "int" "function_name" { P"int x", P"int y" }

Where 'P' is a Lua function that splits the string and create a var_in/var_out 
record.  This would require some changes to how the list of type/name pairs 
are processed, but it should be possible.

I am open to ideas on how to make the bindings syntax easier to use.  I am not 
sure that any of my bindings are even using the "*" marking, so it might be ok 
to drop that marking if keeping the type & name together in one string really 
helps with readability.

I hope other find this bindings generator helpful.

1. https://github.com/Neopallium/LuaNativeObjects/blob/master/README.md

-- 
Robert G. Jakabosky