lua-users home
lua-l archive

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

Thank You for answer

1. You can register C functions into Lua to be made available to your

That's clear (however I must use in script some sophisticated C++ classes (IBPP) which use smart pointers and templates - that's another challenge for me)

2. All loaded functions will remain in the Lua state unless specifically
Functions in Lua are just values assigned to "variables", and will remain
until they are overwritten.

I think I understand.

3. The Lua script loading routines (lua_loadfile, etc.) return a function
representing the script.  So if particular scripts represent repeatable
operations then you can just load them and assign them to an appropriately
named global variable, then call them when needed.

So, rather then include link to another script in script itself - You said I must rather load script in C using lua_loadfile and assign to variable.
This is what I can't understand.
Also this common script will contain a lot of shared functions (for example to draw report elements like tables,comments - particulary I want to generate reports using Lua to build report preview from simple chunks and data returned from SQL database).Could You give me an example how to load common script from buffer to Lua global variable available to ANY script loaded from remote SQL database after that ?

I appreciate any help.


I hope that makes things clearer.

-----Original Message-----
[]On Behalf Of Boguslaw
Sent: Thursday, June 24, 2004 4:34 PM
To: Lua list
Subject: Re: Some newbie questions

Maybe a dumb question,but...

Is it possible to put common functions not in a file but in memory buffer
and some Lua function can locate them when required ? I need load some Lua
scripts from database but common functions should be in memory
buffer/string loaded at program start and always available to scripts.

I'm newbie in Lua.


Best Regards
Bogusław Brandys