[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Direct accessing of application variables from lua
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Tue, 9 May 2000 21:11:32 -0300 (EST)
>From: Falko Poiker <firstname.lastname@example.org>
>The other reason I don't want to use tolua, and this seems to be a problem
>with lua in general, is that it creates wrapper functions for every variable
>and object/structure element accessed by lua.
No really. You only need to create wrapper functions for each *type*.
Variables are exported to Lua as userdata, and variables of the same type
have the same tag, so that they can share the get/setglobal tag methods.
This is exactly what tolua does.
If you need concrete examples of how to do all this, post some
declarations of your variables and I'll send you some sample code.
>Homeworld (our last game) had
>over 10,000 tweakables, so exposing this number of variables to lua would
>result in over 1 megabyte of memory usage simply for the function wrappers.
Do you really have 10,000 different *types*?
>So I've been considering another option - modifying the lua code so that it
>modifies the game variables directly.
You could do this of course, although I don't see you can avoid having several
types in the Value union.
>1. there is no need to pre-register any of the game's variables with Lua -
>the variables are accessed on a "need to know" basis.
Again, I don't see you can avoid this.
Perhaps, I'm missing something.