How do I call the function? #1412
devilish-crow
started this conversation in
General
Replies: 1 comment 3 replies
-
Mostly like that, but You create tables like this. local myTable = {"hello", "world"} There's loads more that tables can do but that's the most basic way that matches how your function seems to be using it.
What is your main programming language? I might be able to translate some of its concepts for you and help you with learning Lua. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Sorry because my main programming language is not lua, but how do I call the function in cc:tweaked ?
Here is my code :
function CUI(m)
local n=1
local l=#m
while true do
term.clear()
term.setCursorPos(1,2)
for i=1, l, 1 do
if i==n then print(i, "["..m[i].."]") else print(i, m[i]) end
end
print("Select a number[arrow up/arrow down]")
local a, b= os.pullEventRaw()
if a == "key" then
if b==200 and n>1 then n=n-1 end
if b==208 and n<=l then n=n+1 end
if b==28 then break end
end
end
term.clear() term.setCursorPos(1,1)
return n
end
function CUI(m)
Beta Was this translation helpful? Give feedback.
All reactions