[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Eval a Lua expression
- From: Eugen-Andrei Gavriloaie <shiretu@...>
- Date: Thu, 3 Apr 2008 00:58:05 +0300
On Apr 3, 2008, at 12:39 AM, David Given wrote:
Eugen-Andrei Gavriloaie wrote:
Sorry if this is a stupid question. But either I can't find the
in the docs because of a "selective" blindness or it's not so obvious
(I'm a newbie in Lua world). So here is the question:
Other people have actually answered your question, but you may want to
consider adopting a slightly different approach: instead of parsing
data structure from C, you could instead parse it from Lua and inform
your C code of the data it needs that way. This might make the code
easier to handle. So either:
for index, o in ipairs(applications) do
...depending on whether you want C or Lua to own the data structures.
Either way, putting the messy bits of the code in Lua might be easier
and more reliable than trying to do it in C --- performance isn't an
───── http://www.cowlark.com ─────
│ "I have always wished for my computer to be as easy to use as my
│ telephone; my wish has come true because I can no longer figure
│ how to use my telephone." --- Bjarne Stroustrup
Yes, it would be great, but is not looking like a configuration file
anymore. A configuration file should be very simple to edit and
maintain. Having the user forced to provide some functions will not be
such a good idea.
Another idea of how to explain this situation popped into my mind
right now. It's like evaluating an expression when you debug a C++
application. It does not alter anything (only if you do stupid things
like null-ing some pointers, calling irreversible functions like
close(fd) on a socket, etc). Mainly, all I want is just evaluating an
expression, not altering anything and be able to do that at run-time.
Thank you for your support guys!