Killa: a new scripting language for Love 0.8.0

General discussion about LÖVE, Lua, game development, puns, and unicorns.
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:Hey Laurens! It looks like I've encountered a bug in Killa.
The problem is in box2d where userData's don't always output correctly, seemingly sporadic.
I attached two files in the last post of this topic: viewtopic.php?f=4&t=9686&p=59605#p59605
You can see the strange output in the killa version, outputting the function instead of the userData.
Any ideas on this one?
Thanks for the detailed report, i didn't test the physics and your test comes handy. I can reproduce the bug and I found it's related with the index base one used in the references (I'm hating these index base one related bugs, but they are expected), I hope I can fix this with a little more time.
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 »

_ex_ wrote:
OmarShehata wrote:Hey Laurens! It looks like I've encountered a bug in Killa.
The problem is in box2d where userData's don't always output correctly, seemingly sporadic.
I attached two files in the last post of this topic: viewtopic.php?f=4&t=9686&p=59605#p59605
You can see the strange output in the killa version, outputting the function instead of the userData.
Any ideas on this one?
Thanks for the detailed report, i didn't test the physics and your test comes handy. I can reproduce the bug and I found it's related with the index base one used in the references (I'm hating these index base one related bugs, but they are expected), I hope I can fix this with a little more time.
Awesome! Let me know as soon as you fix it. I could code around it for the time being until you fix it.

On a side note, I can't seem to be able to compile Killa from the source.. Every time I try to open the msvc10 project and build, it take a lot of time compiling all the files but then just says build failed. I'm guessing there are some libraries I need to link before being able to to do so?

Aaaaalso one last question, I have no idea about the specifics of how Killa was created and designed but, would it have been possible that instead of going and adjusting indexes everywhere, to just have it always subtract 1 from the index when Killa is run?
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: Awesome! Let me know as soon as you fix it. I could code around it for the time being until you fix it.
I think it's fixed, I've uploaded a new download, also I modified a bit your test case and added it as a sample to the distribution. I couldn't test de-referencing so more work is probably needed.
OmarShehata wrote: On a side note, I can't seem to be able to compile Killa from the source.. Every time I try to open the msvc10 project and build, it take a lot of time compiling all the files but then just says build failed. I'm guessing there are some libraries I need to link before being able to to do so?
Use the Visual2008 projects, the 2010 ones are not updated, searching text and compiling was very slow when I was developing Killa on VS2010.
OmarShehata wrote: Aaaaalso one last question, I have no idea about the specifics of how Killa was created and designed but, would it have been possible that instead of going and adjusting indexes everywhere, to just have it always subtract 1 from the index when Killa is run?
I wish there was a single line on the source code of Lua that would allow me to use index base zero, considering that the majority of programmers using it are C++ programmer embedding Lua as a scripting language and it is always confusing. If there is way (I'm not saying no) the Lua authors should know better and you could question them, my probably wrong understanding after reading long threads of the army of programmers that had cried about this in their lua-list is that they don't care, I suspect there is no simple way or they really don't want to tell us. I really admire the work they have done in Lua, but I also don't think that the Lua way is the "holy way" to programming. That was one of my the reasons of creating Killa (the other was to have fun), I was not going to wait for help and just went ahead to change things my own way. The index one problem can be found in many places of the Lua source code, I mean there are many "+ 1" code placed everywhere. If there is a simple way to change this without runtime overhead (they are going to point you to some meta table trick) the little brain over my shoulders could not find it.
With Killa you can use index one if you feel to, just change KILLA_BASE from 0 to 1 in killaconf.h and that is.
that said, Killa needs lots and lots of more testing to be stable.
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 »

_ex_ wrote:
OmarShehata wrote: Awesome! Let me know as soon as you fix it. I could code around it for the time being until you fix it.
I think it's fixed, I've uploaded a new download, also I modified a bit your test case and added it as a sample to the distribution. I couldn't test de-referencing so more work is probably needed.
OmarShehata wrote: On a side note, I can't seem to be able to compile Killa from the source.. Every time I try to open the msvc10 project and build, it take a lot of time compiling all the files but then just says build failed. I'm guessing there are some libraries I need to link before being able to to do so?
Use the Visual2008 projects, the 2010 ones are not updated, searching text and compiling was very slow when I was developing Killa on VS2010.
OmarShehata wrote: Aaaaalso one last question, I have no idea about the specifics of how Killa was created and designed but, would it have been possible that instead of going and adjusting indexes everywhere, to just have it always subtract 1 from the index when Killa is run?
I wish there was a single line on the source code of Lua that would allow me to use index base zero, considering that the majority of programmers using it are C++ programmer embedding Lua as a scripting language and it is always confusing. If there is way (I'm not saying no) the Lua authors should know better and you could question them, my probably wrong understanding after reading long threads of the army of programmers that had cried about this in their lua-list is that they don't care, I suspect there is no simple way or they really don't want to tell us. I really admire the work they have done in Lua, but I also don't think that the Lua way is the "holy way" to programming. That was one of my the reasons of creating Killa (the other was to have fun), I was not going to wait for help and just went ahead to change things my own way. The index one problem can be found in many places of the Lua source code, I mean there are many "+ 1" code placed everywhere. If there is a simple way to change this without runtime overhead (they are going to point you to some meta table trick) the little brain over my shoulders could not find it.
With Killa you can use index one if you feel to, just change KILLA_BASE from 0 to 1 in killaconf.h and that is.
that said, Killa needs lots and lots of more testing to be stable.
one line? no, not unless someone has written an implementation of the table library functions to use index 0 so all you'd have to do is require 'ztable'

even then, you can't use the length operator anymore (although i guess that's not an issue if you're generating code)

also, there likely will be a performance impact; in the standard vm, 0 is part of the hash and not the array (although it's part of the array in luajit), and there's the possibility that assigning to index 0 will prevent lua from populating the array at all and instead just throw everything into the hash instead, at least until the table's next rehash (you'd have to benchmark this to see if this is the case)
If there is way (I'm not saying no) the Lua authors should know better and you could question them, my probably wrong understanding after reading long threads of the army of programmers that had cried about this in their lua-list is that they don't care
well, it was a decision they made nearly 20 years ago not knowing lua would even be used as much as it is now (iirc it wasn't originally intended to go public anyway).
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_ »

Xgoff wrote: one line? no, not unless someone has written an implementation of the table library functions to use index 0 so all you'd have to do is require 'ztable'
even then, you can't use the length operator anymore (although i guess that's not an issue if you're generating code)
also, there likely will be a performance impact; in the standard vm, 0 is part of the hash and not the array (although it's part of the array in luajit), and there's the possibility that assigning to index 0 will prevent lua from populating the array at all and instead just throw everything into the hash instead, at least until the table's next rehash (you'd have to benchmark this to see if this is the case)
In Killa the array part starts with index zero, I have modified the VM to allow that, also the length operator works fine, AFAIK
Xgoff wrote: well, it was a decision they made nearly 20 years ago not knowing lua would even be used as much as it is now (iirc it wasn't originally intended to go public anyway).
Yes I understand, I'm not saying they need to change Lua like lots of people ask in the list, just pointing the changes for that or adding a configuration for that would be very helpful, but I suspect a lot of programmers are going to jump to use base zero indexes and most of the Lua only programmers would remain with base one creating a lot of confusion and division on the Lua camp. Scripts would be no longer compatible. A very hard decision.
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 the engine to the latest version, aded some test like this physics test, thanks to Omar Shebata.

Image

original post UPDATED
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 »

A bit of problem here, love.filesystem.enumerate returns no results (no matter what arguments it's given) as of 0.8.1 version taken from repository downloads few days ago. Test code: http://pastebin.com/PnLmGVLS

One other problem found is that unpack() apparently is one-indexed, since code

Code: Select all

print(unpack([1, 2, 3]))
Returns

Code: Select all

2, 3, null
But, overall (as previously said), this is considerably nice.
Recently wrote a Minecraft modification, which allows external applications to receive and send messages from game.
Following image showcases chat being logged into Killa-Love2d console window, with tags being stripped out in process.
(image link, because I didn't find how to make a spoiler tag here)
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_ »

I was sure that the table functions were already done, but I couldn't find the changes in my 2 repositories.
Sorry about that, the table pack and unpack function are now updated :D and up.

Code: Select all

print(table.unpack([1, 2, 3]))
var t = table.pack(100, 200, 300)
print(t[0], t[1], t[2], t.n)
prints:

Code: Select all

1       2       3
100     200     300     3
I uploaded a new binary for windows.
About the io functions, I'm sure there are things that could be missing, I did not touch them.
However the fix for the enumerate function was simple, I used your test case as a sample :p
Many thanks for the report.
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 »

I don't post here often, though am working on a number of things with Killa. I'll post those to my blog soon (I hope!).
Here are some notes about devbuild (Jan 06 one). Arranged from notes in different projects, so are not as related to each other (topic split per paragraph):

For the development build dated Jan 06, 2013, "killa.exe" somehow denies to start on Windows XP SP2, giving an abstract "Unable to start the program, because it is misconfigured. Reinstallation may fix this problem" error. An interesting part is that "love-killa.exe" still works fine, and same executable works fine on Win7. Problem is confirmed to exist on at least two different installations of this kind (one being an actual machine, and other being an emulated image of "raw" SP2 without updates), so it might be some dependency issue. Said executable is also substantially "fatter" than previous versions (302KB vs 160..180KB).

In development build version of love-killa, for some reason, it is no longer possible to run folders/.zips/.loves by passing them as absolute path parameter - error is given that "main.kia" is not found. Passing folder/archive location as relative location still works though.

As of development build, the "global.arg" array is still oddly indexed. And by "oddly indexed" I mean that killa executable is arg[-2], and arguments start from arg[-1].

It might've been noticed already, but there *is* need for being able to access global variables without "global." prefixing. Syntax starts looking weirder and weirder as you need to access non-functions of global objects or need to access actual function references.
If it's simple enough to implement, I'd like to suggest the following scheme:
* A separate table called "local" is introduced, which holds current local scope variables, and does not throw undeclared variable errors if accessing variables via it:

Code: Select all

print(local.missing) // "null"
print(missing) // error
* If local.__index is set to global, missing variables are also looked up in global table:

Code: Select all

print(some) // error
global.some = 1
print(some) // error
local.__index = global
print(some) // "1"
var some = 2
print(some) // "2"
print(local.some) // null
Now that JavaScript-like naming conventions for global classes are used, maybe it should be "IO", "OS", and not "Io", "Os"? JavaScript name examples of treatening abbreviatures include "innerHTML", "baseURI", "CSSStyleDeclaration", "getAttributeNS", etc. Similarly, things should be probably camelCase'd and using uppercase for constants. Here's a rough list of renaming to be done:

Code: Select all

tostring > toString ; actually, maybe add it to "core" metatable, like in JS
tonumber > toNumber ; could be "parseFloat" with a separate new "parseInt"...
Math.huge > Math.HUGE
Math.pi > Math.PI
Math.randomseed > Math.randomSeed
rawlen > rawLen ; or rawLength
rawequal > rawEqual
rawget > rawGet
collectgarbage > collectGarbage
Package.loadlib > Package.loadLib ; or loadLibrary
Package.searchpath > Package.searchPath
Os.setlocale > OS.setLocale
Os.getenv > OS.getEnv
Os.diffTime > OS.diffTime
Os.tmpname > OS.tmpName
Debug.getupvalue > Debug.getUpValue
Debug.setuservalue > Debug.setUserValue
Debug.getmetatable > Debug.getMetaTable
Debug.setmetatable > Debug.setMetaTable
Debug.setlocal > Debug.setLocal
Debug.gethook > Debug.getHook
Debug.sethook > Debug.setHook
Debug.upvalueid > Debug.upValueId
Debug.upvaluejoin > Debug.upValueJoin
Debug.getinfo > Debug.getInfo
Debug.setupvalue > Debug.setUpValue
Debug.getuservalue > Debug.getUserValue
Debug.getregistry > Debug.getRegistry
Debug.getlocal > Debug.getLocal
Io.tmpfile > IO.tmpFile
getmetatable > getMetaTable
setmetatable > setMetaTable
dofile > doFile ; I'm not so sure about need in this one renaming.
loadfile > loadFile
Pattern for above list could be something like "(%S+) *> *(%S+) *;? *(.*)".
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_ »

Hi YellowAfterlife!

many thanks for the detailed report, about the exe, have you tried recompiling it from source?
It could be possible I uploaded a debug version, I'll check.

About the global variables, I think it would take some time for me to understand the problem and to do something about it, actually the whole "global" thing is a kind of hack on top of the Global Lua table. But I also don't really want to make my scripts polluted with many globals, in my tetris game there is a global object and that it's, I know that is a toy project but still, I'd likely will create an object and pass it to other modules that require the variables inside that object, instead of creating many global variables, I know it needs more discipline to program this way, in any case what you suggest I don't have idea at this moment how to implement it.

Many thanks for the table of pending renaming, I was planning to work more on Killa but RL got busy on my end with 2 new projects that have filled my time, that and Dota 2... :S I was planning to work more on adding a ByteArray class directly to Killa to allow me to achieve fast drawings with canvas methods. I'd like to see your blog and read about what are you working with Killa :D
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests