[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Question about using lua as config file
- From: benjamin sunshine-hill <bsunshin@...>
- Date: Tue, 24 Dec 2002 11:00:43 -0800
where are the nodes being stored? If they're in a particular table, it should be as easy as:
nodes = {} -- global table for all nodes
function Node(newNode) do
-- optionally, check input for correctness here
-- optionally, process input here
nodes.insert(newNode)
end
-- your config file
Ben
----- Original Message -----
From: "woolz2002 <wsoftware@if.rmci.net>" <wsoftware@if.rmci.net>
Date: Tuesday, December 24, 2002 10:54 am
Subject: Question about using lua as config file
> I am fairly new to lua. I have a C++ simulation application I am
> working on, that I am using lua to read in and configure the nodes in
> the sim. However, I have hit a snag. I try to read the following:
>
> Node {
> id = 1,
> name = "test 1",
> position = {
> x = 4.0,
> y = 2.0,
> z = 4000.0
> }
> }
>
> Node {
> id = 2,
> name = "test 2",
> position = {
> x = 9.0,
> y = 4.0,
> z = 4000.0
> }
> }
>
> ...
>
>
> The problem is when I tell lua to read the file, I get the following
> error:
>
> attempt to call global `Node' (a nil value)
>
> I am new enough that I don't know if my file is proper. I am assuming
> that I would need to do something like:
>
> Node = {
> ...
> }
>
> but when I declare another node, I would think this would overwrite
> the first instance.
>
> Anyone have any thoughts on the best way to do this kind of
> initialization, or is it not possible in lua?
>
> Steve Woolsey
>
>
>