Pages: 1 2 »
  Print  
Author Topic: Lua Extension  (Read 10640 times)
Offline (Male) WizzardMaker
Posted on: February 08, 2015, 10:54:50 am
Member
Joined: Feb 2015
Posts: 35

View Profile
Hello folks!
I used my free Weekend to create a Lua Extension for ENIGMA and it worked!
The extension is not finished, the only thing what it can do is open a Lua script and let it search for a variable called "returner" and it can execute a string filled with Lua code.

I will add functions to execute Lua scripts and let it return your variables and I try to add a function that will let Lua execute some GM functions.

Here are the functions that can be executed, what they do and what they need:
Code: [Select]
lua_execute_file(filename)
--filename = Thats the name + path to the Lua script
--What the function needs: It needs a lua script with a variable called "returner".
--What the function returns: It returns the variable "returner" from the Lua script, if the function cant find the variable "returner" or its not a string/integer the function will return "ERROR! UNKNOW RETURNER TYPE OR ERROR IN SCRIPT"
lua_execute_string(code)
--code = What do you think?
--What the function does: For now it does nothing... but I am trying to let the function do the same as lua_execute_file()

Here is the link to the repository of the Lua Extension: https://github.com/WizzardMaker/Lua-Extension

PS: I've written it so that it works, but I'll still have to clean it...
« Last Edit: February 09, 2015, 06:12:17 am by WizzardMaker » Logged
Offline (Unknown gender) TheExDeus
Reply #1 Posted on: February 08, 2015, 02:19:58 pm

Developer
Joined: Apr 2008
Posts: 1860

View Profile
I'll look at it when you post the link. I'm still deciding on what scripting language I want to implement. I ain't big fan of Lua, but maybe it will suffice.
Logged
Offline (Male) WizzardMaker
Reply #2 Posted on: February 09, 2015, 08:03:54 am
Member
Joined: Feb 2015
Posts: 35

View Profile
So the link is up.
I decided to use Lua because I know it, I know the syntax and I know how it works.
I dont really know about other scripting languages and I didnt wanted to read a whole documentation about a new language so I used Lua.
You can make your own extension with another language :)
Logged
Offline (Male) WizzardMaker
Reply #3 Posted on: February 10, 2015, 01:04:35 pm
Member
Joined: Feb 2015
Posts: 35

View Profile
For everybody who wants to install the Extension just copy the folders from the repository to your ENIGMA installation and start ENGIMA, for everybody who gets Syntax errors just check if you have enabled the function in the Game Settings under ENIGMA / Extensions
Logged
Offline (Male) WizzardMaker
Reply #4 Posted on: February 13, 2015, 09:47:00 am
Member
Joined: Feb 2015
Posts: 35

View Profile
I updated the Extension!
There are now functions to add GML functions into Lua
Here are all functions:

-
If there are functions that you want me to add just reply or send me a PM.
« Last Edit: March 09, 2015, 05:14:01 am by WizzardMaker » Logged
Offline (Male) WizzardMaker
Reply #5 Posted on: March 01, 2015, 01:58:49 pm
Member
Joined: Feb 2015
Posts: 35

View Profile
The Lua Extension is "finished" (The code needs some cleanup :D) and ready to be used.
Just download from GitHub and follow my instructions on how to install it.

GitHub page: https://github.com/WizzardMaker/Lua-Extension

There are still some unknown warning messages from the Compiler which I have to fix but its ready to use!

I had to disable some functions, namely:
All of the extension functions (There will be support for it later but not for now)
and all of the functions with varargs as argument (Just look into the LGM function list in the build tab on the top)
and some of the buffer functions
other functions:
Code: [Select]
is_real();is_string();instance_change_inst();abs();min();max();median();
Logged
Offline (Unknown gender) daz
Reply #6 Posted on: May 01, 2015, 02:59:59 am
Contributor
Joined: Jul 2010
Posts: 167

View Profile
Hi. This is a very interesting project. Can you perhaps provide an example of how to use this? It's not immediately clear to me how this works... e.g. for events that only happen once, or events that happen periodically (draw / step).

Also what file formats work with it? Any as it uses simple GML commands?
Logged
Offline (Male) HitCoder
Reply #7 Posted on: May 02, 2015, 07:40:17 am

Member
Location: Oxford, England
Joined: Aug 2014
Posts: 157

View Profile WWW Email
I'll look at it when you post the link. I'm still deciding on what scripting language I want to implement. I ain't big fan of Lua, but maybe it will suffice.

Actually, Lua is a really nice language, the only issue is it's simplism. As a matter of fact though, it's a really damn easy language to learn when it comes to code, so maybe if this is finished we can have games with easy modding support using a Lua interpreter...
Actually, the guide on making an extension in the wiki teaches with Lua, but I could never get that working... PLEASE keep up the work, you've got me really excited! ^^
Logged
Computer Scientist, Programmer in C#, C/C++, Java, Python, GML, EDL, and more. Hobbyist musician.
DISCORD: HitCoder#4530
Offline (Unknown gender) TheExDeus
Reply #8 Posted on: May 02, 2015, 09:00:50 am

Developer
Joined: Apr 2008
Posts: 1860

View Profile
I on the other hand cannot stand Lua syntax. I haven't looked at it that closely though. Maybe after a while you can stand to like it. I did make an AngelScript extension which I could post though. That language is very close to C++ and in turn EDL/GML.
Logged
Offline (Male) WizzardMaker
Reply #9 Posted on: May 03, 2015, 04:23:07 am
Member
Joined: Feb 2015
Posts: 35

View Profile
The Project got updated, there is now an example and some new functions to play with.

Just download the new .zip or update your version with Git.
If there are any questions feel free to ask!

And can somebody answer why the .exe is about 12 MB big when there is just an Object and a Room?
« Last Edit: May 03, 2015, 04:25:19 am by WizzardMaker » Logged
Offline (Unknown gender) TheExDeus
Reply #10 Posted on: May 03, 2015, 07:07:03 am

Developer
Joined: Apr 2008
Posts: 1860

View Profile
See what extensions are added and what systems are used. For example, OpenAL is about 3mb, so if you disable sound system, it will be smaller. Then did you try compiling with Compile option or the Debug/Run options? For me an empty game is 1.17mb.
« Last Edit: May 03, 2015, 10:34:06 am by TheExDeus » Logged
Offline (Male) WizzardMaker
Reply #11 Posted on: May 03, 2015, 01:56:03 pm
Member
Joined: Feb 2015
Posts: 35

View Profile
I just hit run ^^ and with every default extension turned on.

Another problem I do encounter is the tremendous amount of crashes and I don't know why
Logged
Offline (Unknown gender) TheExDeus
Reply #12 Posted on: May 03, 2015, 08:24:38 pm

Developer
Joined: Apr 2008
Posts: 1860

View Profile
The default should still be much smaller than 12mb. Try disabling as much extensions as you can.

LGM was left in a very unstable state sadly. And we don't have Java dev's currently who could work on that. It seems I'm the only one still working on ENIGMA at the moment. Let's hope this is only temporary.
Logged
Offline (Unknown gender) sorlok_reaves
Reply #13 Posted on: May 03, 2015, 10:07:53 pm
Contributor
Joined: Dec 2013
Posts: 260

View Profile
I pushed a patch to fix one of the problems with LGM, but it's not really my area of expertise.

If a particular crash scenario is causing you untold grief, try to narrow down the cause and I'll see what I can do to help. :)
Logged
Offline (Unknown gender) TheExDeus
Reply #14 Posted on: May 04, 2015, 07:32:38 am

Developer
Joined: Apr 2008
Posts: 1860

View Profile
Can you post the .jar somewhere? As Robert and Ism is missing, it would be good if the LGM fixes were still available to download if not in the repo. I personally have problems with LGM freezing when pressing the Run button (or Compile button, or the Debug button), as well as crashing the whole program (windows asks to End Task) when one of the buttons are pressed. So in one case a freeze happens when the ENIGMA plugin is called (LGM then uses 0% of CPU, so it doesn't seem to be stuck in an infinite loop without sleep), and in the second case it happens when the compilation starts (the console starts printing stuff). They are actually very easy to replicate, as I have these crashes on both PC's and they happen at least once every 5 or even less compiles. Sadly no log is created. Also, ENIGMA.exe seems to crash when I try to debug it in GDB (also when it's compiled in Debug mode). I'll see if I can find the cause of that.

But we should probably take this discussion elsewhere.
Logged
Pages: 1 2 »
  Print