Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

It's really my fault. I found an easiest way at all:

function RUN(_x)
 local _test = load(_x)
 return _test()
end

RUN("HeroHP = 1")
RUN("print('HeroHP: '..HeroHP)")
RUN("HeroHP = HeroHP + 1")
RUN("print('HeroHP 2: '..HeroHP)")

PS Now it's a time for make my own pseudo script language for Tic-80. :3

There's the final version to turn any string to code.

-- script: lua
function RUN(_x)
 local _test = load("return ".._x) or load(_x)
 return _test()
end

RUN("t=0")
x=96
y=RUN("24")

function TIC()
 if RUN("btn(0)") then y=y-1 end
 if btn(1) then RUN("y=y+1") end
 RUN("if btn(2) then x=x-1 end")
 if btn(3) then x=x+1 end

 RUN("cls(13)")
 spr(1+t%60//30*2,x,y,14,3,0,0,2,2)
 RUN("print('HELLO WORLD!',84,84)")
 t = RUN("t+1")
end

There's the link: https://tic80.com/play?cart=1819