As far as the database thing goes, you might be able to make a facts / rules system along the lines of this:
Query system
or the "Query Compiler" chapter of this:
On Lisp
(Since you mention "Code is data" I assume you're not afraid of parentheses. )
I've been planning to experiment with this approach for my company's next project, which is likely to be AI-heavy. Nothing handy right now, though.
Some interesting sort-of-related work in Metalua:
Pattern matching
Example Metalua implementation
Conversations in games
- Star Crunch
- Prole
- Posts: 33
- Joined: Sun Feb 15, 2009 12:13 am
- Location: Monterrey, MX
- Contact:
Re: Conversations in games
That's not a bad idea. I was thinking of whipping up a dialogue database editor with Glade/PyGTK and posting it here if anyone expressed interest in it, but then I realized that LOVE currently has no kind of database supportStar Crunch wrote:As far as the database thing goes, you might be able to make a facts / rules system...
Metalua sounds awesome! My favorite part of Lua has always been the bytecode and VM, the language I could do without, really, it kinda nauseates me. Is Metalua usable/mature? (Just to be clear, I'm not suggest using MetaLua to skirt Lua's original syntax!)Star Crunch wrote:Some interesting sort-of-related work in Metalua:
Pattern matching
Example Metalua implementation
- Star Crunch
- Prole
- Posts: 33
- Joined: Sun Feb 15, 2009 12:13 am
- Location: Monterrey, MX
- Contact:
Re: Conversations in games
I haven't had a chance to try it yet. That's also on the TODO list. (I have immediate practical applications for it, e.g. using the code walker tools to auto-generate private keys for instance variables, which is now a painful exercise and results in a sea of brackets.)
From reading around on the Metalua blog and mailing list, and looking at the author's samples, it certainly seems respectable. I think these guys have been doing quite a bit of vetting on the libraries they add, and they saw fit to include it.
According to this the current version is in pure Lua again, so it should be usable from Löve.
From reading around on the Metalua blog and mailing list, and looking at the author's samples, it certainly seems respectable. I think these guys have been doing quite a bit of vetting on the libraries they add, and they saw fit to include it.
According to this the current version is in pure Lua again, so it should be usable from Löve.
Re: Conversations in games
I think I sorta follow that one. Care to explain it? Maybe PM if people are offended by OT posting.Star Crunch wrote:I have immediate practical applications for it, e.g. using the code walker tools to auto-generate private keys for instance variables, which is now a painful exercise and results in a sea of brackets.)
- Star Crunch
- Prole
- Posts: 33
- Joined: Sun Feb 15, 2009 12:13 am
- Location: Monterrey, MX
- Contact:
Re: Conversations in games
Elsewhere our SABDFL threatened to ban the first one to stay on topic...Care to explain it? Maybe PM if people are offended by OT posting.
Basically, to keep access private, you need keys that can't be guessed.[1] This rules out strings (and numbers and booleans), but anything that you can generate and store locally is fine. Tables are the least verbose. Most of my class files begin with something like
Code: Select all
local _x = {}
local _y = {}
local _func = {}
Code: Select all
DO_SOMETHING_AT_POSITION(self[_x], self[_y])
self[_func](self)
My thinking is, so long as I maintain some easily identifiable convention (in this case the leading underscore), I could instead write it as
Code: Select all
DO_SOMETHING_AT_POSITION(self._x, self._y)
self:_func()
I'll probably post a fairly basic demo of some stuff today or tomorrow, if you want to look through and see what I'm doing now.
[1] Also, a simple table won't work because somebody could just pass over it with pairs() and collect the keys. I get around this now via a userdata generated by newproxy(). This thread covers the details pretty well, and at the end Roberto seemed inclined to add some protections into how __pairs and next() will interact in Lua 5.2.
Re: Conversations in games
This is exactly what I thought you meant, and it's a pretty ingenuous reach-around for getting private variables in Lua. In Javascript you can get private variables using closures, but you have to bludgeon proper prototypical inheritance to get itStar Crunch wrote:Basically, to keep access private, you need keys that can't be guessed.[1] This rules out strings (and numbers and booleans), but anything that you can generate and store locally is fine.Care to explain it? Maybe PM if people are offended by OT posting.
Your technique also reminds me of one of the ideas I have written in a notebook on programming language design. The idea would simultaneously knock out two features: enums, and "secret keys" as you describe them. The rule was that if a variable was referenced before being assigned to, it was automatically assigned a unique value!
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 3 guests