Recent

Author Topic: Lua as Scripting Language, Troubles...  (Read 7046 times)

Hydexon

  • Full Member
  • ***
  • Posts: 170
Lua as Scripting Language, Troubles...
« on: January 27, 2011, 11:03:50 pm »
Hello. I am making good in this of FreePascal and i want know how to add an scripting engine in my programs, i decided to use Lua because my programs must be strictly crossplatform, but were i use the Pascal Headers for embed Lua Libs as a problem: Only register functions or procedures, i want of lua modify properties of the form and create new forms or dialogs as pascal script can do, i have an simple solution creating harder functions for alteration.

P.D: Is possible load forms from LFM files at Runtime?
Some help please, Thanks
Lazarus 1.0.4 Stable - FPC 2.6.0 - gtk2 | Linux Mint 14 Nadia | GNOME Shell 3.6.2 - Awesome | Intel x86 | HP Mini 1020-LA Netbook (old)
Lazarus 2.0.2 Stable - FPC 3.0.2 - Windows | Lenovo IdeaPad Y

Leledumbo

  • Hero Member
  • *****
  • Posts: 8835
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Lua as Scripting Language, Troubles...
« Reply #1 on: January 28, 2011, 12:07:58 am »
Quote
i want of lua modify properties of the form and create new forms or dialogs as pascal script can do
Surely it can. What's the problem? Anyway, for better integration with Object Pascal, I suggest using pLua wrapper instead of the default shipped one.
Quote
Is possible load forms from LFM files at Runtime?
If you know how it's loaded, theoritically yes. In newer (>= 0.9.29) approach, it's compiled as a resource in your executable, while latest stable and previous one adds the LFM as string to LazarusResources. The wiki has information about Lazarus resource (but I believe you'll need to experiment yourself).

Hydexon

  • Full Member
  • ***
  • Posts: 170
Re: Lua as Scripting Language, Troubles...
« Reply #2 on: January 28, 2011, 12:14:47 am »
Quote
Is possible load forms from LFM files at Runtime?
I'm referring if is possible load LFM Files at Runtime FROM EXTERNAL FILES
Lazarus 1.0.4 Stable - FPC 2.6.0 - gtk2 | Linux Mint 14 Nadia | GNOME Shell 3.6.2 - Awesome | Intel x86 | HP Mini 1020-LA Netbook (old)
Lazarus 2.0.2 Stable - FPC 3.0.2 - Windows | Lenovo IdeaPad Y

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12601
  • FPC developer.
Re: Lua as Scripting Language, Troubles...
« Reply #3 on: January 28, 2011, 09:49:20 am »
Quote
Is possible load forms from LFM files at Runtime?
I'm referring if is possible load LFM Files at Runtime FROM EXTERNAL FILES

In theory that is also possible, just more work.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8835
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Lua as Scripting Language, Troubles...
« Reply #4 on: January 28, 2011, 10:35:50 am »
Have a look at component streaming example to give you an idea. If you've got it, now you need to know how load it from lfm instead of xml... (I haven't seen any examples, so you maybe have to dig in LCL code).

 

TinyPortal © 2005-2018