function dump(o) if type(o) == 'table' then local s = '{ ' for k,v in pairs(o) do if type(k) ~= 'number' then k = '"'..k..'"' end s = s .. '['..k..'] = ' .. dump(v) .. ',' end return s .. '} ' else return tostring(o) end end TICK_DELAY = 1 / 25 local cursor = color_surface(8, 8, 0, 0, 0) function exercise1() print("Hello World!") warning("Hello Warning!") img = fill_surface(VRESW, VRESH, 0xff, 0x77, 0x00) cursor_setstorage(WORLDID) show_image(img) show_image(cursor) end function exercise1_input(evtbl) if evtbl.source ~= "mouse" then return end if evtbl.samples == nil then return end x, y = cursor_position() sample = evtbl.samples[1] if evtbl.subid == 0 then move_cursor(sample, y) elseif evtbl.subid == 1 then move_cursor(x, sample) else warning("Unknown subid " .. evtbl.subid) end end function exercise1_input_end() x, y = cursor_position() move_image(cursor, x, y, TICK_DELAY) warning("" .. x .. ", " .. y) end