Re: Pass int64
"Valery" <[email protected]>
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <03e301c9dea1$feb1b5d0$80aea8c0@winxpvpc> |
Thanks to all. I think I do not need full LAU support for int64. 2Niki: >>On one of our platforms we work with an API that takes and returns 64 bit numbers. Could you provide the example of using that? I think that is exactly what I need. Regards, Valery ----- Original Message ----- From: Niki Bowe To: [email protected] Sent: Wednesday, May 27, 2009 7:28 AM Subject: Re: [luabind] Pass int64 Done correctly that is the best solution. Itll allow you to do arithmetic on 64 bit integers in lua. Though there is a bit more to it than that. lua_Number will need to be able to hold int64 values without loss. which means youll need to either go with int64 as lua_Number (ie integer only lua) or long double as lua_Number (non portable. no guarantee it can represent all 64 bit ints. eg http://msdn.microsoft.com/en-us/library/9cx8xs15.aspx). or use askos lnum patch against lua and use int64 integers and leave non integers as doubles (my fave). If you are really only ever pushing in "small" int64s (ie ones that are representable as ints) Then you might be better off writing wrapper functions and registering those. (and praying that you never really need the full int64 range) On the other hand if you dont need to do calculations and cant/wont change lua to support int64 then there is another option: On one of our platforms we work with an API that takes and returns 64 bit numbers. We dont need to perform calculations on them, we just need to use them as opaque values. So we added a luabind converter that wraps the 64 bit value in a user data. works for us. downside is that it creates garbage any time we push 64 bit numbers into lua. but we dont do it often. Cheers Niki Bowe Tom McCubbin wrote: I really like that! Just make sure any binary modules are also recompiled w/ the new luaconf.h settings! (you dog...I should have said that ) nice On Tue, 2009-05-26 at 14:53 -0500, James Porter wrote: > I'm sure there is a better/slicker way to achieve it, but this would be the > long typed, least thought out approach Depending on the particulars, an easy way to address this would be to recompile Lua with LUA_INTEGER #defined to __int64 in luaconf.h - Jim ------------------------------------------------------------------------------ Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers & brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, & iPhoneDevCamp as they present alongside digital heavyweights like Barbarian Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com _______________________________________________ luabind-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/luabind-user ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers & brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, & iPhoneDevCamp as they present alongside digital heavyweights like Barbarian Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com ------------------------------------------------------------------------------ _______________________________________________ luabind-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/luabind-user -------------------------------------------------------------------------------- ------------------------------------------------------------------------------ Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers & brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, & iPhoneDevCamp as they present alongside digital heavyweights like Barbarian Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com -------------------------------------------------------------------------------- _______________________________________________ luabind-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/luabind-user ------------------------------------------------------------------------------ Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers & brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, & iPhoneDevCamp as they present alongside digital heavyweights like Barbarian Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com _______________________________________________ luabind-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/luabind-user
(unnamed)
(image/png, 876 B) - not displayed