sharpwind612 / luainterface

Automatically exported from code.google.com/p/luainterface
2 stars 4 forks source link

Luainterface does not allow declaration and manipulation of multi-dimensional arrays. #56

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Start Lua command line interpreter
2. Type require("CLRPackage")
3. Enter: a = Single[5][5] (any multi-dimensional declaration will do)

What is the expected output? What do you see instead?
It is supposed to proxy a 2-dimensional array (I am trying to load a bitmap). 
Instead the Lua interpreter hangs.

What version of the product are you using? On what operating system?
LuaInterface_2.0.3.7z

Please provide any additional information below.
There is no problem with creating an manipulating one-dimensional arrays. 
According to the tutorial (which has errors) one must use the 
Array.CreateInstance method to create multi-dimensional arrays. However, this  
method takes a Type as the first parameter. Luainterface does no produce types 
and it doesn't translate proxytypes into .Net types (which would be very 
convinient). So the only method is to use the explicit syntax 
(<sometype>[size][size][...]).
As far as the errors in the tutorial in reference to arrays: It claims that you 
can use the "array[x] = value" syntax only when it is an array of objects. It 
specifically says that if d is declared as Double[2], for instance, then d[0] = 
value will get an exception. That is not true, d[0] = value works just fine. It 
also states that the method to insert the value should be 
d:SetValue(index,value) when in fact it is the other way arround, that is 
d:SetValue(value,index). At any rate, I tried all the suggestions in the 
tutorial plus I did my own exploration of the problem. I am willing to use 
Array.CreateInstance if you will modify Luainterface so that it generate true 
.Net types from a type proxy. eg: s = Single, st = Type(s) or, plainly, st = 
Type(Single). That will bypass the bug mentioned above (a = Single[x][y])

Original issue reported on code.google.com by anaris...@gmail.com on 10 Feb 2013 at 9:52