Jump to content

? servers

? players online

30 mins if LUA coding

Recommended Posts


  • Content Count:  3791
  • Joined:  08/08/09
  • Status:  Offline

Woah, this is a pretty cool scripting language! Not to sure about the LUAPLAYER though...

 

Here is what i've got so far, just extract the folder and click "script.cmd"

 

The LUA player wasn't made by me though, I was just testing out the positioning and RGB colour codes :)

 

Tell me what you think! Next it'll be turned into a game :)

Link to comment

  • Content Count:  494
  • Joined:  08/23/09
  • Status:  Offline

lua is supposed to be the easiest language to learn but its been a pain for me to try and code in it

 

This. Lua breaks so many coding conventions. As a programmer I absolutely hate Lua.

Link to comment

  • Content Count:  3391
  • Joined:  06/12/09
  • Status:  Offline

Lua is a scripting language, not really a true programming language. It's best not to assume that everything you learn from Lua is how all languages will end up being.

Link to comment

  • Content Count:  3791
  • Joined:  08/08/09
  • Status:  Offline

pffft, this language is stupid, i cba with it anymore... I've also got this one error, WTF does it mean??? Lol

 

error: button.lua:19: loop in gettable

my code

-- ******* Variables ******** 

red = Color.new(255, 0, 0)
blue = Color.new(0, 0, 128)
green = Color.new(0, 100, 0)
orange = Color.new(255, 69, 0)

WPressed = 'You are pressing the "FORWARD" button'
APressed = 'You are pressing the "LEFT" button'
SPressed = 'You are pressing the "BACKWARDS" button'
DPressed = 'You are pressing the "RIGHT" button'
LPressed = 'You are pressing the "L" button' 

-- ******Main Loop******* while true do

screen:clear()
button = Controls.read()

if button:w() then 
screen:print(10,10,WPressed,red)
end
if button:a() then
screen:print(10,10,APressed,blue)
end
if button:s() then
screen:print(10,10,SPressed,green)
end
if button:d() then
screen:print(10,10,DPressed,orange)
end
if button:l() then
screen:print(10,10,LPressed,green)
end
while true do
screen.waitVblankStart()
end

Link to comment

  • Content Count:  494
  • Joined:  08/23/09
  • Status:  Offline

pffft, this language is stupid, i cba with it anymore... I've also got this one error, WTF does it mean??? Lol

while true do
screen.waitVblankStart()
end

 

Could be because you have an infinite loop?

Link to comment

  • Content Count:  494
  • Joined:  08/23/09
  • Status:  Offline

But without the loop it would pop up, then disappear?

 

I dunno then, Lua is one wacky language. :/

 

Edit:

Might be in the I/O function. I wouldn't put it past Lua to have broken internal functions.

Edited by SchmoSalt
Link to comment

Reply to Thread

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...