lua-users home
lua-l archive

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


Thank you very much for the fast reply and the tip about lua_checkstack.

Your solution is 99% what I want, on my point of view the code would be cleaner if I were able to construct the additional array in my C-code. This also opens the possibility to access the data by name instead of the index. Do you have an idea how to do that?

Michael

Klaus Ripke schrieb:
Hi

On Thu, Apr 03, 2008 at 12:05:42PM +0200, Michael Ring wrote:
  
My problem is that I do not know how to put the 5 arrays that I have 
created on the stack in a new array.

This is the syntax that is working for me right now:

#!/usr/bin/env lua
require "perfstat"

adapter1,adapter2,adapter3,adapter4,adapter5 = perfstat.diskadapters();
    
try
array = { perfstat.diskadapters() }

"If the last field in the list has the form exp
and the _expression_ is a function call or a vararg _expression_,
then all values returned by this _expression_ enter the list consecutively."
http://www.lua.org/manual/5.1/manual.html#2.5.7

  
Here's the relevant part of my C-Code for creating the arrays:
    
you may also want to call lua_checkstack

http://www.lua.org/manual/5.1/manual.html#lua_checkstack


regards
Klaus