LunaLua Offical Thread - SMBX Usermod Framework

This is the place for discussion and support for LunaLua and related modifications and libraries.

Shall I steam some LunaLua live development?

Yes
172
92%
No
15
8%
 
Total votes: 187
User avatar
Kevsoft
Ripper II
Ripper II
Posts: 373
Joined: Sun Jul 27, 2014 8:03 am

LunaLua Offical Thread - SMBX Usermod Framework

Postby Kevsoft » Mon Dec 01, 2014 7:57 am

I recently had the idea if I should stream some LunaLua live development. Just say if you would be interested or not.


Because I get often ask where you can download LunaLua, I make a own topic about it.

LunaLua is a addition to lunadll which adds the script language lua. The problem with Autocode (the lunadll-language) is the lack of flexibility that it has (such as the way it lacks custom functions, variables,... etc). With this we don't need any hardcoded code for complex ideas anymore.

So first of all: What is lua?
Lua is an actual script language, which supports custom functions, variables and much more. The script type is something like JavaScript + Visual Basic



Download
Most recent Documentation
Source Code
LunaDLL for lua reference & example page (outdated since v0.2.7, but the examples still working)
LunaLua Tutorial
You might want to google other lua tutorials too.

How to install:
1. Check "Full Installation", check all checkboxes and download the most recent package.
2. Extract the package and profit!

How to update:
1. Check "Only Update" and replace the LuaScriptLib and lunadll.dll in your existing installation.

Example to see if LunaLua is working:
Spoiler: show

Code: Select all

function onLoop()
  printText("PLAYER x="..tostring(player.x).." y="..tostring(player.y), 30, 60)
end


Video Showcase:
Spoiler: show






Which lua-libs can I access?

Code: Select all

string.*
math.*
table.*
debug.*
os.* --Limited (only time/date works), because of security reasons

Reference to the lua libs:
string.*
math.*
table.*
debug.* (probably not needed)
os.* Note: Only os.clock, os.time and os.date works. The rest is limited due security reasons.
Last edited by Kevsoft on Wed Oct 28, 2015 1:30 pm, edited 31 times in total.

User avatar
h2643
Ludwig von Koopa
Ludwig von Koopa
Posts: 2862
Joined: Sat Dec 21, 2013 7:23 am
Current Project: RL
Location: Ukraine (Украина)
Chat Username: h/a troll

Re: LunaLua - Lunadll with lua

Postby h2643 » Mon Dec 01, 2014 8:56 am

Cool, I hope this awesomeness will be stickied! You could add into the post some example videos, which were posted at PGE forum too, that would be better in my opinion ;)
Image Image Image Image
Image Image Image Image
Image Image Image

User avatar
Kevsoft
Ripper II
Ripper II
Posts: 373
Joined: Sun Jul 27, 2014 8:03 am

Re: LunaLua - Lunadll with lua

Postby Kevsoft » Mon Dec 01, 2014 9:08 am

Updated my main post with some videos, so people can see what you can do with it.

Destiny
Volcano Lotus
Volcano Lotus
Posts: 539
Joined: Tue Apr 22, 2014 2:40 pm
Current Project: no
Location: brazil

Re: LunaLua - Lunadll with lua

Postby Destiny » Sat Dec 06, 2014 1:18 pm

So, apparently, LunaLua isn't working for me. I saved this test code in a lunaworld file (obviously in .lua format) but nothing happens. I still need a new exe or something?

EDIT: Yeah, I still need a new exe.
Spoiler: show
Image

francot514
Shy Guy
Shy Guy
Posts: 5
Joined: Thu Dec 04, 2014 2:42 pm

Re: LunaLua - Lunadll with lua

Postby francot514 » Sat Dec 06, 2014 2:51 pm

This will be work without need of new code into the main program?? becuase as i know there is no lua support in sbmx...

User avatar
Kevsoft
Ripper II
Ripper II
Posts: 373
Joined: Sun Jul 27, 2014 8:03 am

Re: LunaLua - Lunadll with lua

Postby Kevsoft » Sat Dec 06, 2014 5:02 pm

Sorry if you guys missed that: Yes you need the modded exe file! The modded exe

User avatar
Kevsoft
Ripper II
Ripper II
Posts: 373
Joined: Sun Jul 27, 2014 8:03 am

Re: LunaLua - Lunadll with lua

Postby Kevsoft » Sun Dec 21, 2014 3:42 am

v0.4 BETA is out.

Please read if you are an api-developer:
Spoiler: show
registerEvent has changed: The first argument has to be the api-table itself and not the api-string anymore!!!!

Code: Select all

registerEvent(table thisTable, string internalEventName, string functionToCall, boolean callBeforeMain)

This change is necessary to make a unique instance of a API.


In Addition for both api-developers and normal users:
Spoiler: show
* loadAPI is no longer using 'require'. I've writte my own loading function.
It will search in following paths for an API:
"{SMBXPath}\LuaScriptsLib\{apiName}.lua"
"{SMBXEpisodePath}\{apiName.lua}"
"{SMBXEpisodePath}\{CustomLevelFolder}\{apiName}.lua"
* loadSharedAPI added: Loads or gets (if already loaded) a shared instance of an API. (lunaworld.lua and lunadll.lua will reference the same API memory)
* hud(boolean displayHud) add: Toggle hud display on/off


Because there are lot of code changes I mark this version as "BETA". If there are any problems then please let me know!

SnifitGuy
Birdo
Birdo
Posts: 1565
Joined: Mon Dec 23, 2013 7:33 pm

Re: LunaLua - Lunadll with lua

Postby SnifitGuy » Tue Dec 23, 2014 6:17 pm

Could you possibly make an updated reference page? I know it may sound stupid, but I just don't want to have to go searching everywhere for new kinds of codes. Also, I tried using this code to display text, but it won't work. Any help?
Code:
Spoiler: show
function onLoop()
printText("This is a test", 3, 30, 30)
end

User avatar
Wohlstand
Birdo
Birdo
Posts: 1583
Joined: Tue Feb 11, 2014 4:44 pm
Current Project: Platformer Game Engine project
Location: Moscow, Russia
Contact:

Re: LunaLua - Lunadll with lua

Postby Wohlstand » Tue Dec 23, 2014 6:37 pm

SnifitGuy wrote:Could you possibly make an updated reference page? I know it may sound stupid, but I just don't want to have to go searching everywhere for new kinds of codes. Also, I tried using this code to display text, but it won't work. Any help?
Code:
Spoiler: show
function onLoop()
printText("This is a test", 3, 30, 30)
end

You also can check the Wiki page with latest LunaLUA references:
http://engine.wohlnet.ru/pgewiki/Category:LunaLua_API
"PGE Project, my Media and supported projects": show
Support me on the Patreon
Image

PGE Project
PGE Project SMBX Topic
PGE Project Official Site and forums
Download fresh experimental builds HERE!
LunaLua
LunaLUA - is a LUA scripting add-on for a LunaDLL

My Media:
My MIDI-music
Pure HQ Music Pack for SMBX
Pure HQ Sound Pack for SMBX
SMBX OPL Sound pack (Created with Yamaha OPL chip and MIDI files)
SMBX38A is here
SMBX-38A download, help and support HERE (SMBX-38A (a.k.a. 1.4.x) - is Chinese unofficial continuation of SMBX)

I'm support:
Image
Image
Image


Image
P.S. I don't like huge signatures which would be annoying, therefore I put huge content into spoilers

SnifitGuy
Birdo
Birdo
Posts: 1565
Joined: Mon Dec 23, 2013 7:33 pm

Re: LunaLua - Lunadll with lua

Postby SnifitGuy » Tue Dec 23, 2014 7:33 pm

Wohlstand wrote:
SnifitGuy wrote:Could you possibly make an updated reference page? I know it may sound stupid, but I just don't want to have to go searching everywhere for new kinds of codes. Also, I tried using this code to display text, but it won't work. Any help?
Code:
Spoiler: show
function onLoop()
printText("This is a test", 3, 30, 30)
end

You also can check the Wiki page with latest LunaLUA references:
http://engine.wohlnet.ru/pgewiki/Category:LunaLua_API

This has been updated more recently, correct? Thanks for the guide...Any idea on what's wrong with my code?

User avatar
Wohlstand
Birdo
Birdo
Posts: 1583
Joined: Tue Feb 11, 2014 4:44 pm
Current Project: Platformer Game Engine project
Location: Moscow, Russia
Contact:

Re: LunaLua - Lunadll with lua

Postby Wohlstand » Tue Dec 23, 2014 7:54 pm

SnifitGuy, quick question:
1) did you saved as "lunadll.lua" file in your custom dir of level?
2) did you correctly installed LunaLUA?
"PGE Project, my Media and supported projects": show
Support me on the Patreon
Image

PGE Project
PGE Project SMBX Topic
PGE Project Official Site and forums
Download fresh experimental builds HERE!
LunaLua
LunaLUA - is a LUA scripting add-on for a LunaDLL

My Media:
My MIDI-music
Pure HQ Music Pack for SMBX
Pure HQ Sound Pack for SMBX
SMBX OPL Sound pack (Created with Yamaha OPL chip and MIDI files)
SMBX38A is here
SMBX-38A download, help and support HERE (SMBX-38A (a.k.a. 1.4.x) - is Chinese unofficial continuation of SMBX)

I'm support:
Image
Image
Image


Image
P.S. I don't like huge signatures which would be annoying, therefore I put huge content into spoilers

SnifitGuy
Birdo
Birdo
Posts: 1565
Joined: Mon Dec 23, 2013 7:33 pm

Re: LunaLua - Lunadll with lua

Postby SnifitGuy » Tue Dec 23, 2014 7:59 pm

Wohlstand wrote:SnifitGuy, quick question:
1) did you saved as "lunadll.lua" file in your custom dir of level?
2) did you correctly installed LunaLUA?


1) It's LunaDLL with Lua, yes? That's the zip I have.
2) I put all the contents of the zip (the folder and two Dll files) in C:\SMBX

User avatar
Wohlstand
Birdo
Birdo
Posts: 1583
Joined: Tue Feb 11, 2014 4:44 pm
Current Project: Platformer Game Engine project
Location: Moscow, Russia
Contact:

Re: LunaLua - Lunadll with lua

Postby Wohlstand » Thu Dec 25, 2014 4:37 pm

SnifitGuy wrote:
Wohlstand wrote:SnifitGuy, quick question:
1) did you saved as "lunadll.lua" file in your custom dir of level?
2) did you correctly installed LunaLUA?


1) It's LunaDLL with Lua, yes? That's the zip I have.
2) I put all the contents of the zip (the folder and two Dll files) in C:\SMBX

Do you got hexed SMBX's exe file which linked with LunaDLL?
"PGE Project, my Media and supported projects": show
Support me on the Patreon
Image

PGE Project
PGE Project SMBX Topic
PGE Project Official Site and forums
Download fresh experimental builds HERE!
LunaLua
LunaLUA - is a LUA scripting add-on for a LunaDLL

My Media:
My MIDI-music
Pure HQ Music Pack for SMBX
Pure HQ Sound Pack for SMBX
SMBX OPL Sound pack (Created with Yamaha OPL chip and MIDI files)
SMBX38A is here
SMBX-38A download, help and support HERE (SMBX-38A (a.k.a. 1.4.x) - is Chinese unofficial continuation of SMBX)

I'm support:
Image
Image
Image


Image
P.S. I don't like huge signatures which would be annoying, therefore I put huge content into spoilers

SnifitGuy
Birdo
Birdo
Posts: 1565
Joined: Mon Dec 23, 2013 7:33 pm

Re: LunaLua - Lunadll with lua

Postby SnifitGuy » Thu Dec 25, 2014 7:05 pm

Wohlstand wrote:
SnifitGuy wrote:
Wohlstand wrote:SnifitGuy, quick question:
1) did you saved as "lunadll.lua" file in your custom dir of level?
2) did you correctly installed LunaLUA?


1) It's LunaDLL with Lua, yes? That's the zip I have.
2) I put all the contents of the zip (the folder and two Dll files) in C:\SMBX

Do you got hexed SMBX's exe file which linked with LunaDLL?


I downloaded the modded exe on the front page.

User avatar
Kevsoft
Ripper II
Ripper II
Posts: 373
Joined: Sun Jul 27, 2014 8:03 am

Re: LunaLua - Lunadll with lua

Postby Kevsoft » Fri Dec 26, 2014 2:17 am

Try to run Autocode (aka. lunadll.txt with some debug code) first. Because when it is executing then it is a issue on my side. Also please check if you have a folder in your main dir called "LuaScriptsLib".

SnifitGuy
Birdo
Birdo
Posts: 1565
Joined: Mon Dec 23, 2013 7:33 pm

Re: LunaLua - Lunadll with lua

Postby SnifitGuy » Fri Dec 26, 2014 7:26 am

Kevsoft wrote:Try to run Autocode (aka. lunadll.txt with some debug code) first. Because when it is executing then it is a issue on my side. Also please check if you have a folder in your main dir called "LuaScriptsLib".

I have the folder inside the SMBX folder, and is the debug code "windowDebug([string] text)"?

User avatar
Kevsoft
Ripper II
Ripper II
Posts: 373
Joined: Sun Jul 27, 2014 8:03 am

Re: LunaLua - Lunadll with lua

Postby Kevsoft » Fri Dec 26, 2014 7:47 am

I have a idea: Provide me a screenshot of your custom folder with the lunadll.lua inside.

SnifitGuy
Birdo
Birdo
Posts: 1565
Joined: Mon Dec 23, 2013 7:33 pm

Re: LunaLua - Lunadll with lua

Postby SnifitGuy » Fri Dec 26, 2014 7:54 am

Oh...nvm, it for some reason works now...I don't know why...

User avatar
Kevsoft
Ripper II
Ripper II
Posts: 373
Joined: Sun Jul 27, 2014 8:03 am

Re: LunaLua - Lunadll with lua

Postby Kevsoft » Sat Dec 27, 2014 5:01 am

Image


LunaLua is now v0.5 BETA. We can now run code in the overworld YAY!
To run your code for the overworld make a file called "lunaoverworld.lua" in your episode dir.

Following events can be used for the world:
Spoiler: show
* onLoad
* onLoop

Following functions can be used for the world:
Spoiler: show
* windowDebug
* printText
* loadImage
* placeSprite
* mem

Classes are not supported yet!

A small Q&A to that:
Spoiler: show
Q: Can we run Autocode (lunadll.txt).
A: No you can only run lua code.

Q: Could you implement Autocode for overworld?
A: I could, but it would take way too long time. If kil does it then I am fine.

Q: Can we deactivate the world HUD?
A: No (maybe later), but the render code is the last painting code which is called. So you can overdraw everything if you want to.

Q: Why BETA?
A: There might be some bugs floating. If you have any issues please report them to me!

User avatar
DarkShadeX
Volcano Lotus
Volcano Lotus
Posts: 535
Joined: Sat Jan 18, 2014 11:34 am

Re: LunaLua - Lunadll with lua

Postby DarkShadeX » Sat Dec 27, 2014 6:54 am

i fu****g love you kevy!


Return to “LunaLua”

Who is online

Users browsing this forum: Sambo and 2 guests