🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Bit manipulation in scripting languages

Started by
5 comments, last by Raduprv 19 years, 11 months ago
After reading around posts on the board, I tried Lua as my first scripting language in my engine. But I found I couldn't do bit manipulation like &(and) or |(or) in Lua. Did I miss anything in the manual? Now I am testing SMALL. I like it's C-like syntax and it has what I need. But Lua is more popular and faster in my little tests. I haven't given it up yet. Can someone give me some suggestions?
Advertisement
It's not part of Lua's core language definition but someone made a patch for it:

http://lua-users.org/wiki/LuaPowerPatches

It's down the page a bit.
Thanks for the answer. But I found my ignorant errors.

Small is slower than Lua (around 10%) if they both interpret the similar (but do the same thing) code and run it. But if the Small source is compiled by its "just-in-time" compiler, there is no match. Small will faster 15 times than Lua.

I hope someday Lua will have its JIT compiler. But before that, I will use Small as the scripting language of my engine. Well, besides the speed, there is still something to check. If I change my mind again, I will tell you.
Quote: Original post by aquastartw
Thanks for the answer. But I found my ignorant errors.

Small is slower than Lua (around 10%) if they both interpret the similar (but do the same thing) code and run it. But if the Small source is compiled by its "just-in-time" compiler, there is no match. Small will faster 15 times than Lua.

I hope someday Lua will have its JIT compiler. But before that, I will use Small as the scripting language of my engine. Well, besides the speed, there is still something to check. If I change my mind again, I will tell you.


Small R0X! if you like C, it will do you much better than LUA. LUA is for those who prefer a lot of abstraction and 'power' as they call it.
If you want a language that is LUA-style and has bit manipulation, take a look at Squirrel(http://squirrel.sourceforge.net)

Actarus
Without starting a war, I'd like to say that if a scripting languages interpreted performance is hurting the real-time performance of your game, then you're probably misusing scripting in the first place. Lua is pretty damn quick compared to many other scripting languages, so much so that performance really shouldn't even be a deciding factor--and you can express many constructs in Lua with a simplicity I haven't seen elsewhere. ( But Small looks intriguing as well, JIT's are still awesome ;) )
It depends what you are using it for. For a single player game (or few players multiplayer) pretty much any scripting is OK. For an MMO server, on the other hand, you DO need a JITed scripting (unless you can afford a bunch of P4s for the server).

This topic is closed to new replies.

Advertisement