This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
LeDark Lua's profile picture

My Costum Lua Scripting Engine

Started by LeDark Lua, 29 June 2015 - 05:27 PM
LeDark Lua #1
Posted 29 June 2015 - 07:27 PM
I made a LuaAPI in a month and I made it like an OS, it has graphics, sound, networking, OS controling and more. Its not ready and I dont know If I will ever release it becouse ( I think ) no one will like it, but anyways I'll post some screenshots!
Screenshots


Here is a BIT of code written in this API

Features you ask? Here:
  • Costum launchers/startups
  • Desktop manipulation
  • Auto Icon creation
  • Code Everything IN Lua!
  • Easy to learn API.
  • Graphics
  • Sound
  • Dll file including
Still I don't know if anyone is interested, BUT if someone is I will post and insert the link where you can download.
Edited on 20 August 2015 - 07:23 AM
CrazedProgrammer #2
Posted 29 June 2015 - 07:38 PM
Cool!
Did you make it for Löve2D or your own engine?
LeDark Lua #3
Posted 29 June 2015 - 07:41 PM
This is all mine!
No Love2D involved!

Oh and ALL IN Lua, I meant you can code everything in lua!
Edited on 29 June 2015 - 05:42 PM
Creator #4
Posted 29 June 2015 - 07:48 PM
What is the support (like CC or Love2D)?
LeDark Lua #5
Posted 29 June 2015 - 07:50 PM
Support IS C++

EDIT: im confused, you mean Lua API as CC's or Love2D? If so, I made my costum "support"
Edited on 29 June 2015 - 05:54 PM
Creator #6
Posted 29 June 2015 - 07:53 PM
Can you share a link to the code?
cyanisaac #7
Posted 29 June 2015 - 11:18 PM
This sounds… awesome! Please polish and release it :D/>.

In fact this is something I've wanted for a secret project idea of mine. I'd love to have it!
LeDark Lua #8
Posted 30 June 2015 - 08:39 AM
Ok I'll keep you guys in touch of any future updates!
I will work on this more now!
LeDark Lua #9
Posted 30 June 2015 - 02:14 PM
Ok guys, I polished it and fixed final bugs!

Download It Here
Mirror

Functions and stuff
Drawdraw.rect(x1, y1, x2, y2, outline) | Draws a rectangle, returns nothing
draw.roundRect(x1, y1, x2, y2, outline) | Draws a rounded rectangle, returns nothing
draw.circle(x, y, radius, outline) | Draws a circle, returns nothing
draw.ellipse(x1, y1, x2, y2, outline) | Draws a ellipse, returns nothing
draw.text(x, y, text) | Draws text at given position, returns nothing
draw.line(x1, y1, x2, y2, width) | Draws a line, returns nothing
draw.background.color(programID, color) | Draws a color background, returns nothing
draw.setColor(color) | Sets the color of text or anything, returns nothing USAGE: draw.setColor(colors.black) draw.rect(16, 16, 32, 32, 0) draw.setColor(colors.white)
draw.getColor() | Returns the current set color
draw.setAlpha(alpha) | Returns nothing, USAGE: draw.setAlpha(.5) draw.rect(16, 16, 32, 32, 0) draw.setAlpha(1) –This rectangle will be transparent
draw.getAlpha() | Returns the current set alpha
draw.setHalign(halign) | Sets the horizontal alignment, returns nothing
draw.setValign(valign) | Sets the vertical alignment, returns nothing
draw.align.center | Center alignment
draw.align.top | Top alignment
draw.align.bottom | Bottom alignment
draw.align.left | Left alignment
draw.align.right | Right alignment
draw.align.middle | Middle alignment
–Primitive is not finnished for ex: draw.primitive.begin(primitive mode) I have them set up but I need to implement them there are: prTrianglePan and more
draw.primitive.begin(primitive) | begins the primitive mode, returns nothing
draw.primitive.beginTex(primitive, texture) | begins the primitive mode with texture, returns nothing
draw.primitive.exit() | clears the primitive buffer and returns to normal mode, returns nothing
draw.vertex(x, y) | Sets a vertex point
draw.vertexTexture(x, y, xTexture, yTexture) Sets a vertex point with texture
vertexTextureExt(x, y, xTexture, yTexture, color, alpha) | Extended version of vertexTexture

Spritesprite.add(spriteFileName, imageNumber, removeBack, xOrigin, yOrigin) | Returns sprite ID
sprite.draw(spriteID, imageIndex, x, y) | Draws a sprite
sprite.drawExt(spriteID, imageIndex, x, y, xScale, yScale, rotation, color, alpha) | this is extended version of sprite.draw
sprite.drawStretched(spriteID, imageIndex, x, y, width, height) | Draws a stretched sprite
sprite.drawStretchedExt(spriteID, imageIndex, x, y, width, height, color, alpha) | this is extended version of sprite.drawStretchedtretched
sprite.delete(spriteID) | Frees the memory
sprite.get.texture(spriteID, subImage)

Mousemouse.pos() | Returns mosue x,y
mouse.click() | Returns 1 if left, Returns 2 if right, Returns 3 if Middle pressed
mouse.hold() | Returns 1 if left, Returns 2 if right, Returns 3 if Middle hold
mouse.release() | Returns 1 if left, Returns 2 if right, Returns 3 if Middle release
mouse.wheel.up() | Returns true if up was rolled
mouse.wheel.down() | Returns true if down was rolled

Colorcolors.make.rgb(red, green, blue) | Makes a color
colors.make.hsv(hue, saturation, value) | Makes a color
colors.aqua
colors.black
colors.blue
colors.dkgray
colors.fuchsia
colors.gray
colors.green
colors.lime
colors.ltgray
colors.maroon
colors.navy
colors.olive
colors.orange
colors.purple
colors.red
colors.silver
colors.teal
colors.white
colors.yellow

Keyboardkeyboard.hold(key) | Returns true if onHold
keyboard.press(key) | Returns true if key was pressed
keyboard.release(key) | Returns true if key was released
keyboard.input.get() | Returns keyboard string
keyboard.input.reset() | Resets the keyboard
keyboard.input.set(string) | Sets the keyboard input
keybaord.input.newLine() | Sets the new line charachter
keyboard.key.* | Returns key ID USAGE: if(keyboard.press(keyboard.key.w)) then draw.text(16, 16, "True") else draw.text(16, 16, "False") end

Filefile.open.read(fileName) | Returns file id
file.open.write(fileName) | Returns file id
file.read.string(fileID) | Returns string of the current line
file.read.int(fileID) | Returns a Integer else error
file.read.newLine()
file.write.string(fileID, string) | Writes a string in a line
file.write.int(fileID, int) | Writes a integer in a line
file.write.newLine(fileID) | writes a new line
file.eof(fileID) | Returns true if end of file
file.eoln(fileID) | Returns true if end of line
file.close(fileID) | Closes the file
file.exists(path) | Returns true if exists

Programprogram.close(programID) | Closes the program
program.minimize(programID) | Minimizes the program
program.ribg(programID, depth, bool) | Runs a program in background if bool=true
program.restart(programID) | Restarts the program

OSos.shutdown() | Closes the OS ( not yours of course :D/> )
os.restart() | Restarts the OS ( not yours silly! )

Desktopdesktop.freeze(bool) | freezes the desktop if bool=true
desktop.getFreeze() | Returns if desktop is freezed!

Little thing I made: notify(string, color) :)/>

More to come in the future! STAY TUNNED!

Why OS name is Love? Thats becouse I wanted to make a Love2D OS but I failed and made my own API.

AND PLEASE! Give me some feedback and help me improve the API, Thanks for using IT!
Edited on 30 June 2015 - 01:16 PM
Creator #10
Posted 30 June 2015 - 03:24 PM
So this is not event based?
LeDark Lua #11
Posted 30 June 2015 - 03:46 PM
Yes no events.

Oh and by the way Creator, if you used it, did you liked it?
Edited on 30 June 2015 - 01:47 PM
Creator #12
Posted 30 June 2015 - 03:53 PM
Yes I liked it! However how do I add more apps? And why is there no main loop in the apps?
LeDark Lua #13
Posted 30 June 2015 - 03:55 PM
Becouse in the engine, I create an object and that object has a loop, in later versions I will make so that you can adjust your game speed. and if you want to add more apps just RightClick on the desktop.
Edited on 30 June 2015 - 01:56 PM
Creator #14
Posted 30 June 2015 - 03:58 PM
Like Love2D? You only make functions and it runs them?
LeDark Lua #15
Posted 30 June 2015 - 03:59 PM
Yes you are right.

EDIT: If I were you, I would run "Help" app, becouse its buggy and you could stuck on some things :/ But if you want, test it, modify it and stuff, but if you are stuck, reopen the LoveOS.exe program.
Edited on 30 June 2015 - 02:14 PM
Creator #16
Posted 30 June 2015 - 04:32 PM
How do I open apps?
LeDark Lua #17
Posted 30 June 2015 - 04:44 PM
Press on the Icon of course :)/>
Creator #18
Posted 30 June 2015 - 04:50 PM
If there is no icon for the program?
LeDark Lua #19
Posted 30 June 2015 - 04:58 PM
Then the engine will create a temporary icon, until the developer will create an icon and insert it where the main.lua file is.
LeDark Lua #20
Posted 04 July 2015 - 03:30 PM
Added Questions and stuff for you guys to help me improve this.
Creator #21
Posted 04 July 2015 - 05:12 PM
I'd like it to be more transparent.

In matters of code, not alpha channel.
LeDark Lua #22
Posted 05 July 2015 - 12:15 PM
hmmm transparent, like more lightweight not so hard?

Or you can learn it easier.

Or you will know what the code does in your head, then code it in the engine?

Soo many options I get in my head when someone says transparent.
Edited on 05 July 2015 - 10:16 AM
Creator #23
Posted 05 July 2015 - 01:21 PM
Easier to code for it and understand the engine
cyanisaac #24
Posted 05 July 2015 - 04:59 PM
Hmm, it would be cool if we could code our own desktop environments and shells for this. Could you maybe put in support for this, like making startup files and stuff, so we can make cool stuff like OSes for it?
LeDark Lua #25
Posted 05 July 2015 - 06:53 PM
Hmm, it would be cool if we could code our own desktop environments and shells for this. Could you maybe put in support for this, like making startup files and stuff, so we can make cool stuff like OSes for it?
I'll think about it, I thought I would make so that other people can costumize the os but I will think about it.
cyanisaac #26
Posted 08 July 2015 - 05:57 AM
Hmm, it would be cool if we could code our own desktop environments and shells for this. Could you maybe put in support for this, like making startup files and stuff, so we can make cool stuff like OSes for it?
I'll think about it, I thought I would make so that other people can costumize the os but I will think about it.

Cooooool. I really wanna make a highres OTOS and this might be the way to do it :D/> :D/> :D/>
LeDark Lua #27
Posted 08 July 2015 - 09:34 AM
Guys vote if you wan't to make your own programs from scratch or you wan't to modify/create apps and such for the built in OS.
Anfred #28
Posted 09 July 2015 - 12:00 AM
This is amazing! You should be proud. Please continue working on this. Building it for raspbian linux would be really great. Then a raspberry pi computer could load your OS at startup… On top on linux?
Also, it seems everyone want you to develop every feature in the voting polls. Congrats on those results!
Edited on 08 July 2015 - 10:04 PM
LeDark Lua #29
Posted 09 July 2015 - 07:03 AM
Thanks Anfred, but making it like a real os I dont know, mabie if I understand corectly I could import my source to linux and start it on startup, but I dont know really.
LeDark Lua #30
Posted 09 July 2015 - 02:06 PM
Short UPDATE


Hey guys, I have an update with sound, so expect sound system in game. I will import simple sound but I will implement the whole sound system.


Networking is a poblem but it coming soon too.
Anfred #31
Posted 09 July 2015 - 09:15 PM
Thanks Anfred, but making it like a real os I dont know, mabie if I understand corectly I could import my source to linux and start it on startup, but I dont know really.
Yeah, you get it more or less. My raspberry pi has a config file that lets you set an app to run at startup, before loading the GUI. "Scratch" is the program that it boots into right now, but simply pointing it at your (linux port) LoveOS would mean it could boot straight into your app, and seem like an OS, even though linux would be running.
You would want full screen 720p resolution, so it was not in a window at startup.

On a different subject, I was prompted to install some 3rd party software when opening your app: "direct play" was the software it wanted. I said skip it, and it still worked well. Maybe you could remove the dependency, or trigger, on direct play. I also had some text display issues: the text was crushed a little, so it distorted the font a bit.

Thanks!
LeDark Lua #32
Posted 09 July 2015 - 10:25 PM
Thanks for the reports, direct play is needed for some stuff to do I left it so that people can install it if they want to run the OS better. And the font is temporary, I'll make my own font using Lua.
Edited on 09 July 2015 - 08:29 PM
LeDark Lua #33
Posted 09 July 2015 - 10:42 PM
Short update from phone, finally added sound. You can:
Add
Free
Play
Loop
Stop
Set Volume
Get Volume
Get Sound Length
Set Sound Position
LeDark Lua #34
Posted 10 July 2015 - 04:37 PM
Ok today im going to release the new update with sound, this will include a nice little media player :)/>
LeDark Lua #35
Posted 10 July 2015 - 06:32 PM
New release!


Whats new?

added Sound

added Media player :)/> for you to check it out

Fixed nasty bugs ( there is still one bug with windows. )





Sound functions

sound.add(path) - Adds sound to memory. returns sound ID

sound.free(soundID) - Free sound memory
sound.play(soundID) - Plays the sound. Returns sound instance ID
sound.stop(instanceID) - Stops the sound.
sound.isPlaying(instanceID) - returns 1 if sound is playing else nil
sound.setVolume(instanceID, volume) - Sets sounds volume from 0 - 1
sound.getVolume(instanceID) - Returns sounds volume
sound.pause(instanceID, bool) - Pauses / unpauses the sound instance
sound.setPos(instanceID, position) - Sets sounds position from 0 - 1
sound.getPos(instanceID) - Returns sound instance position

sound.getLength(instanceID) - Returns sounds length

Edited on 10 July 2015 - 04:35 PM
cyanisaac #36
Posted 11 July 2015 - 07:57 PM
Holy crap this keeps getting better!

if custom OSes can be a thing with custom startups and stuff… holy crap Dan200 might have some serious competition with his secret project :P/>
LeDark Lua #37
Posted 11 July 2015 - 08:04 PM
Thanks :D/> I dont know if it will compete but I love to update this when there is people checking it out, testing it, reporting bugs etc…
LeDark Lua #38
Posted 12 July 2015 - 06:31 PM
In the next update ill mabie add DLL extension importing. What i mean by that, you will make something like Sound.dll and you can import it. Or simpler use the functions written in C/C++

If that will not be in the next update, expect HTTP API then :)/>

Thank you all for support.
Edited on 12 July 2015 - 04:32 PM
LeDark Lua #39
Posted 24 July 2015 - 07:11 PM
Ok guys, just a bit of a clear off:

Right click on desktop = You can create your icon
Right click on the icon = Dropdownmenu of things you can do
Right click on the icon on the bottom = Close, Minimize, Maximize the app.
Anfred #40
Posted 25 July 2015 - 03:57 AM
Very cool! Thanks for the update!
LeDark Lua #41
Posted 25 July 2015 - 06:20 AM
This was actually in the engine all along, I thought y'all got it. But if I'll be fast enough, the real update will be this or next week.

So I see people want to make apps for my os, and they want me to improve it. So I will do just that. I'll leave that pole for few days and remove the last section.
Edited on 25 July 2015 - 04:23 AM
LeDark Lua #42
Posted 29 July 2015 - 01:22 PM
Vertex and DLL update

Added:
*Vertex primitive variables
*Dll including
*Vertex showcase app


Download
Mirror


Functions/Variablesdll.add(dll_path, function_name, call_type, return_type, argument1-5) –Returns ID of the call. Usage: output=dll.add("myDll.dll", "return_string", dll.stdcall, dll.aString, dll.aString)
dll.call(call_id, argument1-5) –Calls the dll function. usage: outputString=dll.call(output, "This is working.")
dll.free(dll_path) –Frees the dll. Usage: dll.free("myDll.dll")
dll.aString –Return/Argument type
dll.aInteger –Return/Argument type
dll.stdcall –Call type
dll.cdecl –Call type
This is used in primitive
draw.primitive.pointList
draw.primitive.lineList
draw.primitive.lineStrip
draw.primitive.triangleList
draw.primitive.triangleStrip
draw.primitive.triangleFan


Im removing the: "Should I make" poll becouse 75% of people want this project to be OS.
Edited on 29 July 2015 - 11:31 AM
Lignum #43
Posted 30 July 2015 - 09:08 PM
You really need to remove that dependency on DirectPlay. The last system to fully support it was Windows XP and support was completely dropped in 2007… what do you need it for anyway? Since you seem to be restricting the program to Windows, why not use WinSock?

I also can't seem to be able to use the dll library. Apparently, it's nil. But do you really want a dll library? It'd give you full access to Win32, which isn't the safest thing to do…
Take this piece of code for example:

local mciSendString = dll.add("winmm.dll", "mciSendStringA", dll.cdecl, dll.aInteger, dll.aString, dll.aString, dll.aInteger, dll.aInteger)
dll.call(mciSendString, "set CDaudio door open", "", 0, 0)
dll.free("winmm.dll")

This code will open the computer's disk drive (or would, if the dll lib worked). Not very malicious, but it demonstrates just how much power you're giving your programs.

While I really wouldn't call this an operating system, you can really tell that you put a lot of effort into this. So, kudos to you!
LeDark Lua #44
Posted 31 July 2015 - 07:21 AM
Oh don't worry, I made so that dll's are imported in safe mode. If I would remove that, you then could make malicious programs/apps and when I reinstalled my Windows and runned my LoveOS.exe I don't get DirectX message. So I don't know what's that.
Lignum #45
Posted 31 July 2015 - 11:27 AM
Oh don't worry, I made so that dll's are imported in safe mode. If I would remove that, you then could make malicious programs/apps and when I reinstalled my Windows and runned my LoveOS.exe I don't get DirectX message. So I don't know what's that.
What's safe mode? I can't find any documentation on it… it sounds pretty interesting though.

Regarding DirectPlay, can't you just remove dplayx.lib from your linker options? Or better: upgrade your DirectX SDK to this one, the 2006 version is the last one to include it. You do have to remove all of your DirectPlay code, though… which you should do anyway considering that it's been deprecated for 8 years now. As I said, consider WinSock, it's a bit harder to use, but it's up to date.
LeDark Lua #46
Posted 31 July 2015 - 12:59 PM
I don't know, for now ill stick to DirectX stuff, and as I said I don't get that install message. Well just install it, untill then ill lookup some DirectX or WinSock.

EDIT: You cant use DLL right now becouse i didnt add them to lua :D/>, I was fast and tired when I released the new update.

When ill fix it, il lcheck if I can use that DLL.
Edited on 31 July 2015 - 11:16 AM
Anfred #47
Posted 31 July 2015 - 05:26 PM
Tried the new one. It works well! The Sound is great too! I also get the install direct play, and hit skip every time. There must be an open source game out there to test, or just to have fun playing?

There are 3 things that could use improvement:
Add a version number to each release – I am confusing them now. Maybe the next release is "Alpha 1.4"
The font is still tearing and distorted
The Directplay is an extra step, that seems unnecessary
LeDark Lua #48
Posted 31 July 2015 - 05:50 PM
Umm, guys, DirectPlay is needed for performance and other fix'es. So please install it. Thanks.

A game, I dont know, If someone will make a little game and post it here, ill implement it with your name :)/>

And I will start adding release notes.

Another neat thing ( I think ) is that I will add publisher of the app ( when mouse is over that ) or when you right click the icon.

Suggestions are apreaceated as well as the comments :)/>
LeDark Lua #49
Posted 02 August 2015 - 02:54 PM
Guys im making a game in my engine. Its based off THIS [ Cubasity name and it was a first game I put on social media or indie dev sites, and another reason why becouse others loved it :P/> I loved my game too despite the my-graphics-making-skillz :)/> ], for LoveOS engine users this will be a great learning experience.

Comments on this?
Edited on 02 August 2015 - 12:56 PM
Creator #50
Posted 02 August 2015 - 10:39 PM
This scripting engine is somewhat similar to Love2D, isn't it?
LeDark Lua #51
Posted 03 August 2015 - 07:29 AM
Awww hell naah, I think love2D is better.
FUNCTION MAN! #52
Posted 09 August 2015 - 11:01 PM
remove all of your DirectPlay code, considering that it's been deprecated for 8 years now.
3d6 #53
Posted 09 December 2015 - 07:01 PM
Is this made in game maker? That would justify having directplay.

I don't mean to necropost but this really is a cool project.
Lemmmy #54
Posted 09 December 2015 - 07:03 PM
btw directplay is a network library if you need it for graphics you need to see a doctor
LeDark Lua #55
Posted 09 December 2015 - 08:02 PM
I discontinued this project a long time ago, and changed my point of view in coding a better engine.
Creator #56
Posted 09 December 2015 - 08:49 PM
Please, don't discount.*Puppy eyes*
Creator #57
Posted 11 December 2015 - 12:41 PM
The download links are not working.
LeDark Lua #58
Posted 11 December 2015 - 05:22 PM
I know, I can't reuplaod it when I lost the source
Creator #59
Posted 11 December 2015 - 06:00 PM
I have it on another PC. I could send it over.
LeDark Lua #60
Posted 11 December 2015 - 09:01 PM
Nono, I lost the source files, where are the CODE stuff. I will rework another engine maybie ;)/>
Lyqyd #61
Posted 09 March 2016 - 10:22 PM
Locked by request.