PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: Icanos on 16 June, 2004, 18:46:08

Title: AfterLast
Post by: Icanos on 16 June, 2004, 18:46:08
Hello

I wounder if someone can try to translate this VB code (from NMDC) to LUA

Function AfterLast(sIn,sLast)
AfterLast = Right(sIn,Len(sIn) - InstrRev(sIn,sLast,-1) - (Len(sLast) - 1))
End Function

Thanks to you who tries to translate it.

// Icanos
Title:
Post by: plop on 16 June, 2004, 19:18:02
tinsert(TableName, DataToInsert)

plop
Title:
Post by: pHaTTy on 16 June, 2004, 20:37:51
QuoteOriginally posted by plop
tinsert(TableName, DataToInsert)

plop

???
Title:
Post by: pHaTTy on 16 June, 2004, 21:20:11
Function AfterLast(sIn,sLast)
AfterLast = Right(sIn,Len(sIn) - InstrRev(sIn,sLast,-1) - (Len(sLast) - 1))
End Function


function AfterFirst(control,data)
local s,e,first,data = strfind(data,control.."(%S+)")
return data
end;


function AfterLast(control,data)
local s,e,first,data = strfind(data,control.."(%S+)")
-- // now lets loop til the end
bool somevar = false;
while(somevar == false)
{
local tempvar = data;
local s,e,first = strfind(data,control)
if first then
local s,e,first,data = strfind(data,control.."(%S+)")
if data then
-- // hummm
else
data = tempvar;
somevar = true;
end;
end
}
return data
end;
Title:
Post by: pHaTTy on 16 June, 2004, 21:23:01
oops soz lol need to practice liua bit again lol


function AfterLast(control,data)
local true = 1; local false = 2
local s,e,first,data = strfind(data,control.."(%S+)")
-- // now lets loop til the end
local somevar = false;
while (somevar == false) then
local tempvar = data;
local s,e,first = strfind(data,control)
if first then
local s,e,first,data = strfind(data,control.."(%S+)")
if data then
-- // hummm
else
data = tempvar;
somevar = true;
end;
end
end;
return data
end;
Title:
Post by: NotRabidWombat on 16 June, 2004, 21:44:46
function AfterLast(sIn, sLast)
   local _, _, ret = strfind(sIn, ".*".. sLast .. "(.-)$");
   return ret;
end
You just have to be carefull that sLast is not a special regex character recognized by strfind.
See the lua manual for more information: http://www.lua.org/manual/4.0/manual.html#6.2

Phatty, %S will only capture non white space characters.

-NotRabidWombat
Title:
Post by: pHaTTy on 16 June, 2004, 21:47:53
QuoteOriginally posted by NotRabidWombat
function AfterLast(sIn, sLast)
   local _, _, ret = strfind(sIn, ".*".. sLast .. "(.-)$");
end
You just have to be carefull that sLast is not a special regex character recognized by strfind.
See the lua manual for more information: http://www.lua.org/manual/4.0/manual.html#6.2

Phatty, %S will only capture non white space characters.

-NotRabidWombat

humm i'll keep that in mind thanks, will av to come back tolua soon anyways ;-)
Title:
Post by: plop on 16 June, 2004, 22:23:10
QuoteOriginally posted by (uk-kingdom)pH?tt?
QuoteOriginally posted by plop
tinsert(TableName, DataToInsert)

plop

???
makes it clear that i don't know vbs. lol

plop
Title:
Post by: NotRabidWombat on 16 June, 2004, 22:41:16
Be glad. I felt dumber after using vbs.

-NotRabidWombat
Title:
Post by: pHaTTy on 16 June, 2004, 23:14:51
Quotemakes it clear that i don't know vbs. lol

plop

you dont want to neither mate lol, to slow n c..p


QuoteOriginally posted by NotRabidWombat
Be glad. I felt dumber after using vbs.

-NotRabidWombat

eheh funny this is so did i :/ lol
Title:
Post by: plop on 16 June, 2004, 23:50:27
i've planned 2 keep it like this.

plop
Title:
Post by: pHaTTy on 17 June, 2004, 03:06:59
QuoteOriginally posted by plop
i've planned 2 keep it like this.

plop

hahh good, altho u shud try c/c++, very nice language c, i was also thinking about checking out delphi, but ive heard its unstable, light on memory and cpu, but unstable so i duno, and due to yhub being port bombed and yhub crashing comp, im guessing thats the unstableness lol
Title:
Post by: Icanos on 18 June, 2004, 19:20:23
Thanks to you all! Love u :P