[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Using LUA for config files
- From: "Kalle Wikstrand" <kallewikstrand@...>
- Date: Thu, 13 Sep 2007 10:14:39 +0200
Let me start by apologizing if this question has already been asked
answered. I searched the forum and found no satisfactory answer. I am very
new to LUA so please keep replys as simple as possible :).
What I want to do is create a config file in LUA that contains values that I
then read into member variables of a c++ class. For example:
Name = Monster,
Hitpoints = 100
The way I would like this to work is something like:
if (lua_isnumber(pLuaState, -1))
m_iHitpoints = (int)lua_tointeger(pLuaState, -1);
This doesn't work since it's a table. What annoyes me is that both gettable
and getfield takes an index when I want to use the keys for readability.
Is there no easy way to do this? Something like lua_getfield(pLuaState,
Enemy, Hitpoints); would be really nice. And what about tables in tables?
FREE pop-up blocking with the new MSN Toolbar - get it now!