luaL_gsub 
文字列s内の文字列pの出現をrで置換してコピーを作成します。
[-0, +1, m]
c
const char *luaL_gsub (lua_State *L, const char *s, const char *p, const char *r);説明 
文字列sの中の文字列pの出現を文字列rで置換することにより、文字列sのコピーを作成します。結果の文字列をスタックにプッシュし、それを返します。
サンプルコード 
c
const char *result = luaL_gsub(L, "hello world", "world", "Lua");
printf("結果: %s\n", result);このコードは、文字列「hello world」の「world」を「Lua」で置き換えた結果を取得し、表示します。
互換性 
- Lua5.1
関連項目 
- lua_pushfstring
- lua_tolstring