[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: ints vs floats typecheck in lua
- From: Doug Rogers <rogers@...>
- Date: Tue, 02 Jan 2007 09:28:55 -0500
Wesley Smith wrote:
> I have a design issue in wrapping a matrix class for Lua.
I am very interested in your matrix/vector package. Are you using a
particular backend such as GSL? It is LGPL'd so could probably be used
by most as a library. I plan to develop a Lua interface to GSL in the
near future.
> mat:setcell(1, 0, "val", {0., 1., 2., 3.}) -> should call lua_tonumber
> mat:setcell(1, 0, "val", {0, 1, 2, 3}) -> should call lua_tointeger
> What is the best practice method of doing this determination?
That information is lost during interpretation of the source into byte
codes. You would have to modify the lexer. I think your original idea is
the appropriate one - 'check the type of the matrix and do lua_tonumber'.
Doug