Skip to content

A scripting language for writing Brick Game Machine games

License

Notifications You must be signed in to change notification settings

premek/brick-script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Brick Script

A scripting language for writing Brick Game Machine games

status

Install dependencies

$ luarocks install lpeg

Run tests

$ ./runtests.sh

or

$ lua test/parser-simple.lua
$ lua test/parser-complex.lua
$ lua test/runtime.lua

Language (WIP)

bricks: [
##
##,
####,
-#
##
#-
]
brickPos: [3,0]
brick: bricks(1)

Integration

local parser = require('brickscript.parser')
local Runtime = require('brickscript.runtime')

local runtime = Runtime()
runtime.assign('a', 3)
runtime.assign('increase', function(i) return i+1 end)
print("i before execution: ", runtime.get('i'))
local script = [[
  i: increase(a)
  value: 100
  increase(value)
]]
local result = runtime.run(parser:match(script))
print("i after execution: ", runtime.get('i'))
print("result: ", result)
$ lua examples/usage.lua
i before execution: 	nil
i after execution: 	4
result: 	101

About

A scripting language for writing Brick Game Machine games

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published