lua-users home
lua-l archive

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


[Andreas Falkenhahn <andreas@airsoftsoftwair.de>]
> On 04.08.2004 at 14:02 David Given wrote:
> 
> >I suspect that the real answer to your question is 'You don't want to do 
> >that.' What are you trying to do?
> 
> I want to implement a function which creates a new table and initializes
> it, e.g.
> 
> newarray(test, 100)
> 
> Now the C function newarray() should do the following Lua code:
> 
> test = {}
> for i=1,100 do test[i] = 0 end
> 
> To do this, I somehow need to retrieve the string "test" in order
> to push it on the stack and call lua_newtable(). 


Why not just change it to:

 test = newarray(100)

I think making new implicit binding forms is confusing and
error-prone... Is there some reason why it's important in this case?

Matt

-- 
Matt Hellige                  matt@immute.net