Hello!
Congratulations for the new style of your site!
But: am I right that the “code” tag no longer works? [import]uid: 4331 topic_id: 977 reply_id: 300977[/import]
Hello!
Congratulations for the new style of your site!
But: am I right that the “code” tag no longer works? [import]uid: 4331 topic_id: 977 reply_id: 300977[/import]
Did it work before? [import]uid: 5712 topic_id: 977 reply_id: 2218[/import]
It’s never really worked right. Fixing that is on my list of todos. I’ll keep you guys posted. [import]uid: 3 topic_id: 977 reply_id: 2229[/import]
The <code> and [code] tags work in the new design now. In fact they work better than ever before. We’ve added syntax highlighting, and it recognizes Lua by default. For other languages try <as> or <as3>, for instance.
The code tag did work before, but it had to be added around every line. Yuck! Now you only need one <code> tag before your code and one </code> at the end. Line numbers show up and all formatting is preserved. Yay!
Here’s an example:
--my favorite explode function for lua
function explode(div,str)
if (div=='') then return false end
local pos,arr = 0,{}
-- for each divider found
for st,sp in function() return string.find(str,div,pos,true) end do
table.insert(arr,string.sub(str,pos,st-1)) -- Attach chars left of current divider
pos = sp + 1 -- Jump past current divider
end
table.insert(arr,string.sub(str,pos)) -- Attach chars right of last divider
return arr
end
-- USAGE:
local contents = "apples,bananas,oranges"
local fruits = explode(",", contents)
print ("I go ".. fruits[2] .." for ".. fruits[1] .." and ".. fruits[3] .."!")
explode function from http://lua-users.org/wiki/MakingLuaLikePhp [import]uid: 5917 topic_id: 977 reply_id: 2429[/import]