Skip to content

Instantly share code, notes, and snippets.

@sagnew
Last active April 24, 2018 23:01
Show Gist options
  • Save sagnew/2d9db4061236a4f6978402ca5fcf98e4 to your computer and use it in GitHub Desktop.
Save sagnew/2d9db4061236a4f6978402ca5fcf98e4 to your computer and use it in GitHub Desktop.
pokemon
function read_file(name)
local input = io.open(name, 'r')
if input ~= nil then
io.input(input)
content = io.read()
io.close(input)
return content
end
return nil
end
function file_exists(name)
local f = io.open(name, 'r')
local exists = f ~= nil
io.close(f)
return exists
end
function press_button(button)
input_table = {}
input_table[button] = true
joypad.set(1, input_table)
end
while true do
local button = read_file('button.txt')
if button ~= nil then
press_button(button)
emu.message('Pressing: ' .. button)
os.remove('button.txt')
end
emu.frameadvance()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment