textmate bundle additions for lua
4 posters
textmate bundle additions for lua
Here is a script that will generate the text additions needed for the Textmate lua language bundle to add syntax coloring to SIO2/GL/AL wrapped functions, defines, and enums.
Place the script in [sio dir]/src/lua/swig. Running the script will parse through sio.module and print out a wall of text that looks like:
Paste this text in the bundle editor in the Lua language bundle (the text box will be titled 'Edit Language: "Lua") somewhere in the pattern list and hit "Test".
Code like "SIO2.sio2ResourceRender" and "SIO2.SIO2_RENDER_SOLID_OBJECT" should be colored now.
- Code:
#!/usr/bin/env python
import re
fileIN = open("sio2.module", "r")
line = fileIN.readline()
functions = re.compile(".*[\s|\*]([\w]+)\s*\([\.,\w\*\s]*\)\s*;")
defines = re.compile("^\s*#(define|DEFINE)\s([\w]+)\s.*")
enum_start = re.compile("^\s*typedef\s+enum.*")
enum = re.compile("^\s*([_A-Z0-9]+).*")
enum_end = re.compile("^\s*}.*")
func_bundle = "{ name = 'support.function.library';\
match = '(?<![.:])\\b(SIO2\.("
define_bundle = "{ name = 'meta.preprocessor.macro.c';\
match = '\\b(SIO2\.("
func_first = True
define_first = True
enum_ready = False
while line:
m = enum_start.match(line)
if m and not enum_ready:
enum_ready = True
m = enum_end.match(line)
if m:
enum_ready = False
m = enum.match(line)
if m and enum_ready:
if not define_first:
define_bundle = define_bundle + '|'
else:
define_first = False
define_bundle = define_bundle + m.group(1)
m = functions.match(line)
if m:
if not func_first:
func_bundle = func_bundle + '|'
else:
func_first = False
func_bundle = func_bundle + m.group(1)
m = defines.match(line)
if m:
if not define_first:
define_bundle = define_bundle + '|'
else:
define_first = False
define_bundle = define_bundle + m.group(2)
line = fileIN.readline()
define_bundle = define_bundle + "))\\b';\
},"
print define_bundle
func_bundle = func_bundle + "))\\b(?=\()';\
},"
print func_bundle
Place the script in [sio dir]/src/lua/swig. Running the script will parse through sio.module and print out a wall of text that looks like:
- Code:
{ name = 'meta.preprocessor.macro.c'; match = '\b(SIO2\.(SIO2_VERSION_COPYRIGHT|SIO2_VERSION_WEBSITE|SIO2_VERSION_EMAIL|SIO2_VERSION_AUTHOR|SIO2_VERSION_MAJOR|SIO2_VERSION_MINOR|
....
|AL_INVERSE_DISTANCE_CLAMPED|AL_LINEAR_DISTANCE|AL_LINEAR_DISTANCE_CLAMPED|AL_EXPONENT_DISTANCE|AL_EXPONENT_DISTANCE_CLAMPED))\b'; },
{ name = 'support.function.library'; match = '(?<![.:])\b(SIO2\.(sio2Init|sio2InitGL|sio2InitAL|sio2ShutdownAL|sio2InitLUA|
...
|alBufferData|alBufferf|alBuffer3f|alBufferfv|alBufferi|alBuffer3i|alBufferiv|alGetBufferf|alGetBuffer3f|alGetBufferfv|alGetBufferi|alGetBuffer3i|alGetBufferiv|alDopplerFactor|alDopplerVelocity|alSpeedOfSound|alDistanceModel))\b(?=\()'; },
Paste this text in the bundle editor in the Lua language bundle (the text box will be titled 'Edit Language: "Lua") somewhere in the pattern list and hit "Test".
Code like "SIO2.sio2ResourceRender" and "SIO2.SIO2_RENDER_SOLID_OBJECT" should be colored now.
zzajin- Posts : 81
Join date : 2008-10-14
Re: textmate bundle additions for lua
Thats a sweet little bundle.
I have a question for you: why are you using lua instead of just coding in C? I have not been able to come up with any reason at all to use lua besides user created downloadable scripts (not a very good reason).
I have a question for you: why are you using lua instead of just coding in C? I have not been able to come up with any reason at all to use lua besides user created downloadable scripts (not a very good reason).
uprise78- Posts : 228
Join date : 2008-10-31
Re: textmate bundle additions for lua
I am personally using LUA for my game the following way:
- Set the characters animations sequence within Blender
- Dialogs
- Characters stats
- Items stats
- Goals definition
- Game settings
I am also thinking of creating a small IDE to create GUI, drag drop, click click click, pop the callback code etc... so basically every piece of GUI in the game is a LUA script. The point of using LUA is to don't have to recompile the whole game when changes are made or simply to offload some code that can be dynamically loaded...
- Set the characters animations sequence within Blender
- Dialogs
- Characters stats
- Items stats
- Goals definition
- Game settings
I am also thinking of creating a small IDE to create GUI, drag drop, click click click, pop the callback code etc... so basically every piece of GUI in the game is a LUA script. The point of using LUA is to don't have to recompile the whole game when changes are made or simply to offload some code that can be dynamically loaded...
Re: textmate bundle additions for lua
can't people with a jailbroken device go in and change the lua script? If you use it for stats your online high score(if you got one) would be screwed. Unless you make a check for whats on, lets say line 50, and if it's changed the app won't start, just tell the user to redownload the app. Just a thought
oioioi- Posts : 136
Join date : 2008-12-02
Location : Norway
Re: textmate bundle additions for lua
All the .LUA are bundled within an SIO2 file and are password protected... so there's no way the users can get access to it...
Re: textmate bundle additions for lua
For me LUA support is perhaps the main feature of SIO2.
I've created a remote console/terminal for SIO2. It's a desktop app which connects via bonjour and can send/receive data. The two main use cases are sending LUA commands/scripts and sending game assets. The goal is to create an environment for rapid game dev/prototyping by avoiding recompiling and uploading the app to the device.
Compiling is so tiresome
I've created a remote console/terminal for SIO2. It's a desktop app which connects via bonjour and can send/receive data. The two main use cases are sending LUA commands/scripts and sending game assets. The goal is to create an environment for rapid game dev/prototyping by avoiding recompiling and uploading the app to the device.
Compiling is so tiresome
zzajin- Posts : 81
Join date : 2008-10-14
Re: textmate bundle additions for lua
Open up a password protected zip file isn't hard, unless you use a password with lots of wierd characters, but it will stll be possible
oioioi- Posts : 136
Join date : 2008-12-02
Location : Norway
Re: textmate bundle additions for lua
zzajin,
That sounds like an interesting way to play with things in SIO2. Do you care to share the code or submit to SIO2?
On a side note, to speed up compile time check out the post on sprites that I put up a week or so ago. The project download in there compiles everything except SIO2 from the source into a static lib and speeds things up A LOT.
That sounds like an interesting way to play with things in SIO2. Do you care to share the code or submit to SIO2?
On a side note, to speed up compile time check out the post on sprites that I put up a week or so ago. The project download in there compiles everything except SIO2 from the source into a static lib and speeds things up A LOT.
zzajin wrote:For me LUA support is perhaps the main feature of SIO2.
I've created a remote console/terminal for SIO2. It's a desktop app which connects via bonjour and can send/receive data. The two main use cases are sending LUA commands/scripts and sending game assets. The goal is to create an environment for rapid game dev/prototyping by avoiding recompiling and uploading the app to the device.
Compiling is so tiresome :sleep:
uprise78- Posts : 228
Join date : 2008-10-31
Re: textmate bundle additions for lua
uprise78 wrote:zzajin,
That sounds like an interesting way to play with things in SIO2. Do you care to share the code or submit to SIO2?
Yes, I plan on making it available. I'm still working out bugs, polishing, and discovering how to best work with it. For instance, I'm adding a variable inspector/editor now that I figured out how to dynamically traverse all the global LUA variables.
zzajin- Posts : 81
Join date : 2008-10-14
Permissions in this forum:
You cannot reply to topics in this forum
|
|