SteveKChiu / lua-intf

A binding between C++11 and Lua language
MIT License
419 stars 90 forks source link

Unlimited parameters in function #125

Open TheAifam5 opened 8 years ago

TheAifam5 commented 8 years ago

Hi, Its possible to make unlimited parameters like for printf in LuaIntf? For example:

LuaBinding(luaContext).addFunction("printf", &printf)

I found this: http://lua-users.org/wiki/LuaPrintf And i think is possible to make that.

Regards TheAifam5.

SteveKChiu commented 8 years ago

You can not add function with ... argument directly, there is no such binding for LuaIntf. You can, however, implement CFunction like function to access lua stack, and having unlimited arguments.

TheAifam5 commented 6 years ago

Yea, then theoretically could be possible by using va_args and lua stack. I’m not good at this btw :D