Author Topic: PLUGIN: Lua for AGS  (Read 45189 times)

Calin Leafshade

  • Long live King Cat!
    • I can help with making music
    • I can help with voice acting
    • Calin Leafshade worked on one or more games that won an AGS Award!
    •  
    • Calin Leafshade worked on one or more games that was nominated for an AGS Award!
Re: PLUGIN: Lua for AGS
« Reply #140 on: 11 Sep 2014, 15:05 »
There is significantly more.

The AGS-Lua link is purely manual. If you want to trigger AGS events in lua then you need to wire that up yourself.

You need a fairly good grasp of programming before you'll be able to understand how this is done.

Re: PLUGIN: Lua for AGS
« Reply #141 on: 11 Sep 2014, 15:28 »
Ok, I converted the intro room script to Lua.
Do I put the Lua code in place of the original ags room code.
Or is their more?
There's an explanation with script examples in the very first post of this very thread.

In short, you are to put "Lua.RunScript("whatever_name_i_have.lua");" in game_start, and then put "Lua.Call("my_function_name")" whenever you want to call a function from lua script.
« Last Edit: 11 Sep 2014, 15:32 by Crimson Wizard »

Re: PLUGIN: Lua for AGS
« Reply #142 on: 11 Sep 2014, 21:41 »
Thanks for the replies.  Looks like I won't be able to use this.
What if your blessings come through raindrops
What if your healing comes through tears...

Re: PLUGIN: Lua for AGS
« Reply #143 on: 21 Nov 2014, 08:34 »
Just for information. When I go to the download page it says "Subscription Expired". No downloads available.

Dualnames

  • Local Moderator
  • Pretty Badass
    • Dualnames worked on one or more games that won an AGS Award!
    •  
    • Dualnames worked on one or more games that was nominated for an AGS Award!
Re: PLUGIN: Lua for AGS
« Reply #144 on: 01 Mar 2015, 05:06 »
http://duals.agser.me/Plugins/LuaForAGS_v4.rar

Found an old cd, and it had a version of certain plugins and one of them happened to be lua.
No more military army stuff. I'm alive and back.

Re: PLUGIN: Lua for AGS
« Reply #145 on: 11 May 2016, 08:02 »
Hi,
sorry for writing in this old topic, but I have a problem with this plugin.
I have installed it correctly and it works fine with simple lua scripts. But now, in order to write my real code, I need another lua module (luasql.sqlite, exactly).
In this case, what should I do? I am not expert about how Lua Works and I haven't found any dll for that module; and If I am not wrong the modules I got must be installed directly into lua.

Can you give me any hint?

Thanks.
Hi, this signature is not funny because my imagination is actually on holiday.

Monsieur OUXX

  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
    • Monsieur OUXX worked on one or more games that won an AGS Award!
    •  
    • Monsieur OUXX worked on one or more games that was nominated for an AGS Award!
Re: PLUGIN: Lua for AGS
« Reply #146 on: 11 May 2016, 09:30 »
Hi,
sorry for writing in this old topic, but I have a problem with this plugin.
I have installed it correctly and it works fine with simple lua scripts. But now, in order to write my real code, I need another lua module (luasql.sqlite, exactly).
In this case, what should I do? I am not expert about how Lua Works and I haven't found any dll for that module; and If I am not wrong the modules I got must be installed directly into lua.

Can you give me any hint?

Thanks.
You'd be probably better off asking on the Lua forums, but I'm sure Calin Leafshade will help if he sees your update (did you try PM'ing him?)
 

Re: PLUGIN: Lua for AGS
« Reply #147 on: 11 May 2016, 09:41 »
Hi,
sorry for writing in this old topic, but I have a problem with this plugin.
I have installed it correctly and it works fine with simple lua scripts. But now, in order to write my real code, I need another lua module (luasql.sqlite, exactly).
In this case, what should I do? I am not expert about how Lua Works and I haven't found any dll for that module; and If I am not wrong the modules I got must be installed directly into lua.

Can you give me any hint?

Thanks.
You'd be probably better off asking on the Lua forums, but I'm sure Calin Leafshade will help if he sees your update (did you try PM'ing him?)

I've done that some day ago(with another question, to be honest), but I've got no answer.
You know, I found a "sqlite3.dll" file, but I fear it's not enough - I'd should add something which allows comunication between lua and sqlite, shouldn't I? :P Before asking to official lua forums (where I am not sure they know about this old plugin) I wanted to ask here, I'll be waiting some time. :)
« Last Edit: 11 May 2016, 09:43 by TheNaiker »
Hi, this signature is not funny because my imagination is actually on holiday.

Snarky

  • Global Moderator
  • Private Insultant
    • Best Innovation Award Winner 2018, for his numerous additions to the AGS open source ecosystem including the new Awards Ceremony client and modules
    • Snarky worked on one or more games that won an AGS Award!
    •  
    • Snarky worked on one or more games that was nominated for an AGS Award!
Re: PLUGIN: Lua for AGS
« Reply #148 on: 11 May 2016, 17:51 »
I would start by writing a proof-of-concept test just in Lua (without AGS) to access SqlLite. This seems to be how to load a DLL: https://www.lua.org/pil/8.2.html, or you could try this: http://alien.luaforge.net/

If you can't get that to work, you need Lua-specific help. If you can, it should also work in AGS, and if it doesn't there might be something you need to do with the plugin or AGS build.
« Last Edit: 11 May 2016, 17:55 by Snarky »

Re: PLUGIN: Lua for AGS
« Reply #149 on: 11 May 2016, 19:38 »
Thanks, your second hint looks to be good. I typed this
Code: Lua
  1. function readDb (ID)
  2. assert (package.loadlib("sqlite3.dll", "luaopen_luasql_sqlite3"))()  
  3. env = luasql.sqlite3()
  4. con = env:connect("test.db")
  5. res = con:execute("create table person( id integer primary key,name text not null, email text, phone text)")
  6. con:close()
  7. env:close()
  8. a = 12
  9. return a
  10. end
And after compiling and running the "test.db" file has been created without error messages. (I used the A variable to see if Ags runs the script)
I will make further tests, but I am satisfied with this. Thanks again.
Hi, this signature is not funny because my imagination is actually on holiday.

Snarky

  • Global Moderator
  • Private Insultant
    • Best Innovation Award Winner 2018, for his numerous additions to the AGS open source ecosystem including the new Awards Ceremony client and modules
    • Snarky worked on one or more games that won an AGS Award!
    •  
    • Snarky worked on one or more games that was nominated for an AGS Award!
Re: PLUGIN: Lua for AGS
« Reply #150 on: 11 May 2016, 20:02 »
Sweet! I don't know Lua, but that looks good so far. And thanks for posting your sample code, I'm sure that could be helpful for others.

Hope it works out.
« Last Edit: 11 May 2016, 20:04 by Snarky »

Re: PLUGIN: Lua for AGS
« Reply #151 on: 22 Jan 2018, 21:10 »
Hey! What's the status of this plugin? Is there an update? Is source code available somewhere? The first page link points to an expired wiki.

I played a little bit with love2d this weekend and would like to test using lua to use shaders :]

Re: PLUGIN: Lua for AGS
« Reply #152 on: 02 Jul 2018, 12:51 »
Hey! What's the status of this plugin? Is there an update? Is source code available somewhere? The first page link points to an expired wiki.

We have this plugin as submodule in our repository. Actual repository is https://github.com/duncanc/Lua-for-AGS/commits/master

The status of plugin is unknown. It seems to be made in such way that requires continious sync with the engine to have full support. Yet it was last updated in 2013, which means it cannot work with the any recently added engine API.
Also the reason I believe we should drop supporting this plugin when developing AGS 4 branch, because plugin is strictly tied to the engine's data layout in memory. Unless there would be a maintainer who rewrites it in a different way.

Re: PLUGIN: Lua for AGS
« Reply #153 on: 28 Aug 2019, 17:18 »
Answering to myself after an year, I just started taking a look into this plug-in to see how the hell it works.

Apparently a part of the code is generated by a script. I also didn't find that script yet.

Unfortunately it doesn't use the proper Engine plug-in API and instead does weird things as CW suggests.

About my own questions on Shaders, which is unrelated to it, but I was too dumm at the time to know, it's a different issue. It would require AGS to expose the texture where screen is drawn or something similar for the plug-in interface, which right now only has the "screen bitmap", which only exists using Software Render and is only exposed on the plug-in interface of Windows build of the engine. Shaders are doable on a plug-in side if it's possible to access the texture that's going to be presented to the screen. It would probably be an OpenGL only feature.