lua-users home
lua-l archive

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


Denis Andreev wrote:
> In our project we use this:
>
> render = Library { "render" }
> -- load DLL, and create it object (userdata) instance in table
>
> shader = render.Shader { "graphics/shaders/gloss" }
> -- create object (userdata) from render.DLL
>
> But, if we do this:
>
> render = nil
> -- unload render.DLL
>
> Program go to unpredicted state.
>
> The question is: how we can control this situation?

note that the render will only be unloaded after a gc cicle.
if you don't want the user to remove the render, you could use setglobal tag
method to avoid it. See previous threads about constant variables.
if you want to launch an exception or ignore when the user indexes the
render, you can do:

render = nullobject

where nullobject has the appropiate gettable tag methods.


Ignacio Castaño
castano@asidesoft.com


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com