Killa: a new scripting language for Love 0.8.0

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Killa: a new scripting language for Love 0.8.0

Post by Robin »

YellowAfterlife wrote:Add a automatic 'tostring' type coercion when adding values to string (anything + string = string in JS).
That's one of the worst misfeatures in JavaScript. (See what {} + {} and [] + [] result in.)
Help us help you: attach a .love.
User avatar
Xgoff
Party member
Posts: 211
Joined: Fri Nov 19, 2010 4:20 am

Re: Killa: a new scripting language for Love 0.8.0

Post by Xgoff »

Robin wrote:
YellowAfterlife wrote:Add a automatic 'tostring' type coercion when adding values to string (anything + string = string in JS).
That's one of the worst misfeatures in JavaScript. (See what {} + {} and [] + [] result in.)
and on the opposite end of the scale, apparently there's plans to remove all automatic coercion from lua, even though it doesn't have the same wierdness as js due to having separate addition and concatenation operators (and not allowing binary operations on incompatible types period, unless overridden)
blaymakar
Prole
Posts: 1
Joined: Tue May 08, 2012 5:56 pm

Re: Killa: a new scripting language for Love 0.8.0

Post by blaymakar »

Are you a hundred percent sure about that?
User avatar
YellowAfterlife
Prole
Posts: 29
Joined: Mon Jan 23, 2012 4:05 pm
Contact:

Re: Killa: a new scripting language for Love 0.8.0

Post by YellowAfterlife »

Robin wrote:
YellowAfterlife wrote:Add a automatic 'tostring' type coercion when adding values to string (anything + string = string in JS).
That's one of the worst misfeatures in JavaScript. (See what {} + {} and [] + [] result in.)
I didn't ask for type coercion for other cases (array/metatable addition), didn't I?

Probably isn't that good idea to do automatic type coercion (leaves you without any knowledge about doing something stupid), but useful for some cases.
So I added a function add(value, ...) to my small (but growing) list of 'shortcut' functions.
Result is determined by left-most value, thus giving you this output with given paste code:

Code: Select all

String + Number: 45
Number + String: 9
String + Table: Text{ 0: 7 }
Table + String: { 0: 7, 1: Text }
Table + Table: { 0: 1, 1: 2 }
As a note to author, it is rather strange to be able to access global.* scope as module functions, but not be able to reference such without 'global.' prefix
yal.cc
Contains things I work on. Also gets Love2d examples time to time.
User avatar
_ex_
Citizen
Posts: 65
Joined: Thu Dec 08, 2011 2:59 pm

Re: Killa: a new scripting language for Love 0.8.0

Post by _ex_ »

YellowAfterlife wrote:As a note to author, it is rather strange to be able to access global.* scope as module functions, but not be able to reference such without 'global.' prefix
Yes this is part of my design, I hate global variables and global state. Forcing me to think twice before using one is part of my mantra. So in Killa if you want global variables you have to pay the tax of typing always global.something. This has a very nice effect, you can check all you global variables with a simple search, ie: my tetris clone has only one global variable and it's the reference to the love object :D

EDIT:
wow YellowAfterLife I just checked your module and I think I really misunderstood you, also very nice work there!! Loving where are you going with the language.

What I understand now is that you wanted enforcing the access of global functions through the "global" symbol, this was originally my idea and Killa was working like at the beginning but having to type global.print() every time I was doing my tests was not fun, of course you could declare a local reference but then there is all the math and table and string functions... I was considering to add something like an include header to Killa something like #include "stdlib.kia" but I could not finish the idea and I was not really sure about that.

Killa was made to have fun (blatant copy of Ruby/Matz philosophy :D ) So allowing the creation of global variables was not fun due to the silent and hidden bugs in my code, however forcing to call every global function with global... hmmm I 'm not sure, I was expecting to have even less users with that strict rule, because misnomer global functions crash the moment they are called (calling a null object crash), although not in compile time.
But I think most of the security and correctness concerns come from the lack of classes in Lua something I'm thinking how to address right now, when you use a method not declared in a class the error can be found at compile time. So this is going to help.
By the way you could use:

Code: Select all

public function ifnull() { }
instead of

Code: Select all

global.ifnull = function() { }
Again many thanks for your feedback I'm pretty sure you are the second user of Killa after me and right now you represent my use base and have a very strong and vocal voice :D
User avatar
YellowAfterlife
Prole
Posts: 29
Joined: Mon Jan 23, 2012 4:05 pm
Contact:

Re: Killa: a new scripting language for Love 0.8.0

Post by YellowAfterlife »

_ex_ wrote:
YellowAfterlife wrote:As a note to author, it is rather strange to be able to access global.* scope as module functions, but not be able to reference such without 'global.' prefix
Yes this is part of my design, I hate global variables and global state. Forcing me to think twice before using one is part of my mantra. So in Killa if you want global variables you have to pay the tax of typing always global.something. This has a very nice effect, you can check all you global variables with a simple search, ie: my tetris clone has only one global variable and it's the reference to the love object :D

EDIT:
wow YellowAfterLife I just checked your module and I think I really misunderstood you, also very nice work there!! Loving where are you going with the language.

What I understand now is that you wanted enforcing the access of global functions through the "global" symbol, this was originally my idea and Killa was working like at the beginning but having to type global.print() every time I was doing my tests was not fun, of course you could declare a local reference but then there is all the math and table and string functions... I was considering to add something like an include header to Killa something like #include "stdlib.kia" but I could not finish the idea and I was not really sure about that.

Killa was made to have fun (blatant copy of Ruby/Matz philosophy :D ) So allowing the creation of global variables was not fun due to the silent and hidden bugs in my code, however forcing to call every global function with global... hmmm I 'm not sure, I was expecting to have even less users with that strict rule, because misnomer global functions crash the moment they are called (calling a null object crash), although not in compile time.
But I think most of the security and correctness concerns come from the lack of classes in Lua something I'm thinking how to address right now, when you use a method not declared in a class the error can be found at compile time. So this is going to help.
By the way you could use:

Code: Select all

public function ifnull() { }
instead of

Code: Select all

global.ifnull = function() { }
Again many thanks for your feedback I'm pretty sure you are the second user of Killa after me and right now you represent my use base and have a very strong and vocal voice :D
My actual intent was to access functions without global.* prefix, but that didn't work, as I've now understood, because I didn't add 'public' prefix.
I tried to do

Code: Select all

function table.add() { ...
, that (now obviously) raised an error 'table is undefined', which have lead me into short testing and prefixing them with 'global.*'. So no, you don't need to add requirement for 'global' prefix before function calls, it'd make things quite longer, which is probably not a wished effect.
Got to poking Love2d version (I was playing around with console one, since print() is cool, you know) with a friend today - we've figured out that apparently current downloadable version checks for existence of 'main.lua' in folder you drag onto love2d executable, despite of executing code in main.kia later. Perhaps you should fix that.
Other things:
* Could probably add "..=" operator, this feels like a missing part to assignment operators at the moment.
* Could make it so that string.* functions also take zero-based indexes for characters, similar to arrays.
* Apparently "#" operator is missing/renamed. How does one find length of metatable?
Overall, quite fun.
yal.cc
Contains things I work on. Also gets Love2d examples time to time.
User avatar
_ex_
Citizen
Posts: 65
Joined: Thu Dec 08, 2011 2:59 pm

Re: Killa: a new scripting language for Love 0.8.0

Post by _ex_ »

YellowAfterlife wrote: Got to poking Love2d version (I was playing around with console one, since print() is cool, you know) with a friend today - we've figured out that apparently current downloadable version checks for existence of 'main.lua' in folder you drag onto love2d executable, despite of executing code in main.kia later. Perhaps you should fix that.
Other things:
* Could probably add "..=" operator, this feels like a missing part to assignment operators at the moment.
* Could make it so that string.* functions also take zero-based indexes for characters, similar to arrays.
* Apparently "#" operator is missing/renamed. How does one find length of metatable?
Overall, quite fun.
Yes, I realized that the engine was still looking for some *lua files, it was already fixed in the repo, can you compile and check it?

The "..=" doesn't seem too hard to implement, I was reluctant to add it because it looked weird and I had little time, but I think it can be useful, (but we must use table.concat preferably because concatenating many strings can be slow).

Yes the string library functions were not touched, they must be made index zero also, it's in my TODO.

The # operator was reserved for pre-processing, I really need a pre-processor in-place to allow my game accommodate to different platforms, so I saved the # token for that, instead I borrowed the '$' symbol from Perl and used it. (in Perl it means 'scalar')

I'm doing a tutorial soon about the main differences and the genesis of Killa but I have had a very hectic week here, sorry. Also I want to create a list of changes for the next version in the bitbucket repository.

The official Killa repository is here: https://github.com/ex/Killa
The cocos2d-x engine with Killa support is here: https://github.com/ex/cocos2d-x

Thanks for your feedback! :D
User avatar
_ex_
Citizen
Posts: 65
Joined: Thu Dec 08, 2011 2:59 pm

Re: Killa: a new scripting language for Love 0.8.0

Post by _ex_ »

I updated Killa to support the ..= operator. (combined concatenation and assignment kind of += for strings)

Also Killa now disallows the creation of mixed tables, you'll need to create dictionary tables with {} and array tables with [].

Uploaded a fractal viewer as another sample, I'm sorry about the lack of documentation, I hope that reading the source code of the supplied samples would give you some idea of how to program in Killa. It's more and more like AS3/Haxe :D
User avatar
OmarShehata
Party member
Posts: 259
Joined: Tue May 29, 2012 6:46 pm
Location: Egypt
Contact:

Re: Killa: a new scripting language for Love 0.8.0

Post by OmarShehata »

I just found this and I want to say, this project is brilliant!! Programming with Lua was beginning to seem frustrating, and then this graceful language lands into existence!

I'm a bit confused as to how to start using it though. My questions are:

1) Is Killa stable enough to be used for a commercial game? Even if there's a bug or two, I think the massive headaches Killa would prevent with its stricter nature would far outweigh using just Lua

2) If I'm on Windows, do I need the MVSC project files to actually code in Killa or just to modify the source? I managed to edit and compile the tetris demo using Sublime, but:

3)Why is there a .lua and a .kia version of every file in the tetris demo? Editing the "game.kia" seems to affect the game as it should, but the game.lua isn't updated. (I commented out the code that drops the blocks in the .kia, but it was still there in the game.lua and it seemed the .kia was the one being executed) but then I tried to delete the .lua files but the project wouldn't work then. How does this work exactly?

EDIT: Disregard what I said in the previous point. It seems the .kia files there are just to show how the code would look in kia? I think I got the hang of it. I'm compiling by opening the love-killa.exe, but would like to know how it should be done. Like how I would distribute the game later on etc..

4)How do I assemble the love-killa.exe as in the tetris demo? Is it just the same like a normal love file? Like, what do I need to create a new project with Killa?

Sorry if this has been answered before, but I can't seem to find this info. If it's not answered, then hey, maybe others will benefit from this info and more people will be using Killa!

Thanks!
User avatar
_ex_
Citizen
Posts: 65
Joined: Thu Dec 08, 2011 2:59 pm

Re: Killa: a new scripting language for Love 0.8.0

Post by _ex_ »

OmarShehata wrote:I just found this and I want to say, this project is brilliant!! Programming with Lua was beginning to seem frustrating, and then this graceful language lands into existence!
Thanks! I was also tired of Lua syntax and now that Killa is usable I'm not using Lua anymore, but Killa rest in the shoulders of Lua, so all the kudos for the Lua authors because all the hard work was already done :D
OmarShehata wrote: 1) Is Killa stable enough to be used for a commercial game? Even if there's a bug or two, I think the massive headaches Killa would prevent with its stricter nature would far outweigh using just Lua
I would say it's usable in its current 0.1 version, remember that Killa is based on Lua 5.2 and Lua by itself it's pretty stable, if there are bugs in there they are likely my bugs :p, in all this time I found 2 rare bugs in Killa, they are still not fixed but they block compilation and are easy to workaround so I guess nothing serious, I have made a simple tetris game and a simple fractal viewer, they work as expected, if there are other bugs they are likely to be in the engine integration, I didn't touched the physics module, and coroutines are also not tested. I would love to have more tests done by others.

I was kind of worried about closures because I did some changes there but it seems to me that closures are working fine, and what a beautiful thing they are with a JavaScript like syntax: https://github.com/ex/Killa/blob/3d16bd ... 9beers.kia

Just now I ported the fractal viewer to cocos2d-x, it's in github already and I'm pleased to announce that Killa is now working fine in mobiles thanks to its integration with cocos2d-x, here is an screenshot on iOS, but this is also tested on android devices:
Image

So in resume: yes Killa would help you with the problem of global variables created silently, but:
OmarShehata wrote: 2) If I'm on Windows, do I need the MVSC project files to actually code in Killa or just to modify the source? I managed to edit and compile the tetris demo using Sublime, but:
3)Why is there a .lua and a .kia version of every file in the tetris demo? Editing the "game.kia" seems to affect the game as it should, but the game.lua isn't updated. (I commented out the code that drops the blocks in the .kia, but it was still there in the game.lua and it seemed the .kia was the one being executed) but then I tried to delete the .lua files but the project wouldn't work then. How does this work exactly?
Love-Killa has only being compiled in Windows, there are no MacOSX/Linux binaries, last time I tried to compile Love for mac I failed miserably due to a lot of missing dependencies, it was not simple and I didn't have enough time, also I don't have a mac at hand. You'll need to be proficient with compiling Love and making the changes for mac and linux if it's not ready by me, it's just a matter of updating the projects but is not trivial if you don't have the target system at hand and have some familiarity with the building tools, so I'll say that you'll need to be able to do this if you want to use Killa in a commercial product and fix any possible bugs still not found in these operative systems.

Right now I'd only recommend Killa to the brave souls that can hack his way reading the source code, it's not friendly for newcomers, if you have only used Lua inside Love and don't have touched the engine I don't recommend you using Killa unless you are only targeting Windows and there are no blocker bugs that need to be fixed, sure I'll get to compile Love-killa for mac/linux in the future and I'll check for any bug report but I can not make promises about schedules.
OmarShehata wrote: 4)How do I assemble the love-killa.exe as in the tetris demo? Is it just the same like a normal love file? Like, what do I need to create a new project with Killa?
Please use the latest version on bitbucket, the HEAD is the stable version, if you have visual 2008 compile the exe, I'm not sure if the last exe is compiled, if it is not I'll upload a new version, but this is for windows only, you'll need to distribute the Love-killa exe with the folder of your game with the *.kia files, there is no need to add a batch or modify shortcuts because Love-killa looks for the folder "game", this way you only need to drop the folder to the user and start the program, Love-killa must run the same as Love 0.8.0, I didn't changed or modified the rendering support, just the scripting support.

thanks for being interested on Killa!
Cheers
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests